[PATCH 3/4] mtd: spi-nor-core: Rework default_init() to take flash_parameter
tkuw584924 at gmail.com
tkuw584924 at gmail.com
Mon Apr 15 06:33:10 CEST 2024
From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
default_init() fixup hook should be used to initialize flash parameters
when its information is not provided in SFDP. To support that case, it
needs to take flash_parameter structure like as other hooks.
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
---
drivers/mtd/spi/spi-nor-core.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 1bfef6797f..8f371a5213 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -203,7 +203,8 @@ struct sfdp_bfpt {
* table is broken or not available.
*/
struct spi_nor_fixups {
- void (*default_init)(struct spi_nor *nor);
+ void (*default_init)(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params);
int (*post_bfpt)(struct spi_nor *nor,
const struct sfdp_parameter_header *bfpt_header,
const struct sfdp_bfpt *bfpt,
@@ -2775,10 +2776,11 @@ static void spi_nor_post_sfdp_fixups(struct spi_nor *nor,
nor->fixups->post_sfdp(nor, params);
}
-static void spi_nor_default_init_fixups(struct spi_nor *nor)
+static void spi_nor_default_init_fixups(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
if (nor->fixups && nor->fixups->default_init)
- nor->fixups->default_init(nor);
+ nor->fixups->default_init(nor, params);
}
static int spi_nor_init_params(struct spi_nor *nor,
@@ -2885,7 +2887,7 @@ static int spi_nor_init_params(struct spi_nor *nor,
}
}
- spi_nor_default_init_fixups(nor);
+ spi_nor_default_init_fixups(nor, params);
/* Override the parameters with data read from SFDP tables. */
nor->addr_width = 0;
@@ -3328,7 +3330,8 @@ static int s25fs_s_setup(struct spi_nor *nor, const struct flash_info *info,
return spi_nor_default_setup(nor, info, params);
}
-static void s25fs_s_default_init(struct spi_nor *nor)
+static void s25fs_s_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->setup = s25fs_s_setup;
}
@@ -3452,7 +3455,8 @@ static int s25_s28_setup(struct spi_nor *nor, const struct flash_info *info,
return spi_nor_default_setup(nor, info, params);
}
-static void s25_default_init(struct spi_nor *nor)
+static void s25_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->setup = s25_s28_setup;
}
@@ -3544,7 +3548,8 @@ static int s25fl256l_setup(struct spi_nor *nor, const struct flash_info *info,
return -ENOTSUPP; /* Bank Address Register is not supported */
}
-static void s25fl256l_default_init(struct spi_nor *nor)
+static void s25fl256l_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->setup = s25fl256l_setup;
}
@@ -3613,7 +3618,8 @@ static int spi_nor_cypress_octal_dtr_enable(struct spi_nor *nor)
return 0;
}
-static void s28hx_t_default_init(struct spi_nor *nor)
+static void s28hx_t_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->octal_dtr_enable = spi_nor_cypress_octal_dtr_enable;
nor->setup = s25_s28_setup;
@@ -3705,7 +3711,8 @@ static int spi_nor_micron_octal_dtr_enable(struct spi_nor *nor)
return 0;
}
-static void mt35xu512aba_default_init(struct spi_nor *nor)
+static void mt35xu512aba_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->octal_dtr_enable = spi_nor_micron_octal_dtr_enable;
}
@@ -3795,7 +3802,8 @@ static int spi_nor_macronix_octal_dtr_enable(struct spi_nor *nor)
return 0;
}
-static void macronix_octal_default_init(struct spi_nor *nor)
+static void macronix_octal_default_init(struct spi_nor *nor,
+ struct spi_nor_flash_parameter *params)
{
nor->octal_dtr_enable = spi_nor_macronix_octal_dtr_enable;
}
--
2.34.1
More information about the U-Boot
mailing list