mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 14:34:28 +08:00
mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is defined
spi_nor_post_sfdp_fixups() was called even when there were no SFDP tables defined. late_init() should be instead used for flashes that do not define SFDP tables. Use spi_nor_post_sfdp_fixups() just to fix SFDP data. post_sfdp() hook is as of now used just by s28hs512t, mt35xu512aba, and both support SFDP, there's no functional change with this patch. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Link: https://lore.kernel.org/r/20211207140254.87681-5-tudor.ambarus@microchip.com
This commit is contained in:
parent
ff67592cbd
commit
5273cc6df9
@ -2642,26 +2642,6 @@ static void spi_nor_info_init_params(struct spi_nor *nor)
|
|||||||
spi_nor_init_uniform_erase_map(map, erase_mask, params->size);
|
spi_nor_init_uniform_erase_map(map, erase_mask, params->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* spi_nor_post_sfdp_fixups() - Updates the flash's parameters and settings
|
|
||||||
* after SFDP has been parsed (is also called for SPI NORs that do not
|
|
||||||
* support RDSFDP).
|
|
||||||
* @nor: pointer to a 'struct spi_nor'
|
|
||||||
*
|
|
||||||
* Typically used to tweak various parameters that could not be extracted by
|
|
||||||
* other means (i.e. when information provided by the SFDP/flash_info tables
|
|
||||||
* are incomplete or wrong).
|
|
||||||
*/
|
|
||||||
static void spi_nor_post_sfdp_fixups(struct spi_nor *nor)
|
|
||||||
{
|
|
||||||
if (nor->manufacturer && nor->manufacturer->fixups &&
|
|
||||||
nor->manufacturer->fixups->post_sfdp)
|
|
||||||
nor->manufacturer->fixups->post_sfdp(nor);
|
|
||||||
|
|
||||||
if (nor->info->fixups && nor->info->fixups->post_sfdp)
|
|
||||||
nor->info->fixups->post_sfdp(nor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spi_nor_late_init_params() - Late initialization of default flash parameters.
|
* spi_nor_late_init_params() - Late initialization of default flash parameters.
|
||||||
* @nor: pointer to a 'struct spi_nor'
|
* @nor: pointer to a 'struct spi_nor'
|
||||||
@ -2712,15 +2692,12 @@ static void spi_nor_late_init_params(struct spi_nor *nor)
|
|||||||
* Please note that there is a ->post_bfpt() fixup hook that can overwrite
|
* Please note that there is a ->post_bfpt() fixup hook that can overwrite
|
||||||
* the flash parameters and settings immediately after parsing the Basic
|
* the flash parameters and settings immediately after parsing the Basic
|
||||||
* Flash Parameter Table.
|
* Flash Parameter Table.
|
||||||
|
* spi_nor_post_sfdp_fixups() is called after the SFDP tables are parsed.
|
||||||
|
* It is used to tweak various flash parameters when information provided
|
||||||
|
* by the SFDP tables are wrong.
|
||||||
*
|
*
|
||||||
* which can be overwritten by:
|
* which can be overwritten by:
|
||||||
* 4/ Post SFDP flash parameters initialization. Used to tweak various
|
* 4/ Late flash parameters initialization, used to initialize flash
|
||||||
* parameters that could not be extracted by other means (i.e. when
|
|
||||||
* information provided by the SFDP/flash_info tables are incomplete or
|
|
||||||
* wrong).
|
|
||||||
* spi_nor_post_sfdp_fixups()
|
|
||||||
*
|
|
||||||
* 5/ Late flash parameters initialization, used to initialize flash
|
|
||||||
* parameters that are not declared in the JESD216 SFDP standard, or where SFDP
|
* parameters that are not declared in the JESD216 SFDP standard, or where SFDP
|
||||||
* tables are not defined at all.
|
* tables are not defined at all.
|
||||||
* spi_nor_late_init_params()
|
* spi_nor_late_init_params()
|
||||||
@ -2740,8 +2717,6 @@ static int spi_nor_init_params(struct spi_nor *nor)
|
|||||||
!(nor->info->flags & SPI_NOR_SKIP_SFDP))
|
!(nor->info->flags & SPI_NOR_SKIP_SFDP))
|
||||||
spi_nor_sfdp_init_params(nor);
|
spi_nor_sfdp_init_params(nor);
|
||||||
|
|
||||||
spi_nor_post_sfdp_fixups(nor);
|
|
||||||
|
|
||||||
spi_nor_late_init_params(nor);
|
spi_nor_late_init_params(nor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1228,6 +1228,25 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* spi_nor_post_sfdp_fixups() - Updates the flash's parameters and settings
|
||||||
|
* after SFDP has been parsed. Called only for flashes that define JESD216 SFDP
|
||||||
|
* tables.
|
||||||
|
* @nor: pointer to a 'struct spi_nor'
|
||||||
|
*
|
||||||
|
* Used to tweak various flash parameters when information provided by the SFDP
|
||||||
|
* tables are wrong.
|
||||||
|
*/
|
||||||
|
static void spi_nor_post_sfdp_fixups(struct spi_nor *nor)
|
||||||
|
{
|
||||||
|
if (nor->manufacturer && nor->manufacturer->fixups &&
|
||||||
|
nor->manufacturer->fixups->post_sfdp)
|
||||||
|
nor->manufacturer->fixups->post_sfdp(nor);
|
||||||
|
|
||||||
|
if (nor->info->fixups && nor->info->fixups->post_sfdp)
|
||||||
|
nor->info->fixups->post_sfdp(nor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters.
|
* spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters.
|
||||||
* @nor: pointer to a 'struct spi_nor'
|
* @nor: pointer to a 'struct spi_nor'
|
||||||
@ -1408,6 +1427,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spi_nor_post_sfdp_fixups(nor);
|
||||||
exit:
|
exit:
|
||||||
kfree(param_headers);
|
kfree(param_headers);
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user