mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
mtd: spi-nor: core: get rid of SNOR_OVERLAID_REGION flag
Only SNOR_OVERLAID_REGION is defined for flags in the spi_nor_erase_region structure. It can be replaced by a boolean parameter. Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Reviewed-by: Michael Walle <mwalle@kernel.org> Link: https://lore.kernel.org/r/076416d5dc8328dec72d31db12b9bec96bf0ac66.1708404584.git.Takahiro.Kuwano@infineon.com Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
This commit is contained in:
parent
df6e36edac
commit
2865ed0e2c
@ -1557,8 +1557,7 @@ spi_nor_find_best_erase_type(const struct spi_nor_erase_map *map,
|
||||
continue;
|
||||
|
||||
/* Alignment is not mandatory for overlaid regions */
|
||||
if (region->flags & SNOR_OVERLAID_REGION &&
|
||||
region->size <= len)
|
||||
if (region->overlaid && region->size <= len)
|
||||
return erase;
|
||||
|
||||
/* Don't erase more than what the user has asked for. */
|
||||
@ -1595,7 +1594,7 @@ spi_nor_init_erase_cmd(const struct spi_nor_erase_region *region,
|
||||
cmd->opcode = erase->opcode;
|
||||
cmd->count = 1;
|
||||
|
||||
if (region->flags & SNOR_OVERLAID_REGION)
|
||||
if (region->overlaid)
|
||||
cmd->size = region->size;
|
||||
else
|
||||
cmd->size = erase->size;
|
||||
@ -1653,7 +1652,7 @@ static int spi_nor_init_erase_cmd_list(struct spi_nor *nor,
|
||||
goto destroy_erase_cmd_list;
|
||||
|
||||
if (prev_erase != erase || erase->size != cmd->size ||
|
||||
region->flags & SNOR_OVERLAID_REGION) {
|
||||
region->overlaid) {
|
||||
cmd = spi_nor_init_erase_cmd(region, erase);
|
||||
if (IS_ERR(cmd)) {
|
||||
ret = PTR_ERR(cmd);
|
||||
|
@ -245,19 +245,17 @@ struct spi_nor_erase_command {
|
||||
* inside this region. The erase types are sorted in
|
||||
* ascending order with the smallest Erase Type size being
|
||||
* at BIT(0).
|
||||
* @flags: flags to determine if this region is overlaid.
|
||||
* @overlaid: determine if this region is overlaid.
|
||||
*/
|
||||
struct spi_nor_erase_region {
|
||||
u64 offset;
|
||||
u64 size;
|
||||
u8 erase_mask;
|
||||
u8 flags;
|
||||
bool overlaid;
|
||||
};
|
||||
|
||||
#define SNOR_ERASE_TYPE_MAX 4
|
||||
|
||||
#define SNOR_OVERLAID_REGION BIT(0)
|
||||
|
||||
/**
|
||||
* struct spi_nor_erase_map - Structure to describe the SPI NOR erase map
|
||||
* @regions: array of erase regions. The regions are consecutive in
|
||||
|
@ -142,13 +142,12 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
|
||||
}
|
||||
|
||||
seq_puts(s, "\nsector map\n");
|
||||
seq_puts(s, " region (in hex) | erase mask | flags\n");
|
||||
seq_puts(s, " region (in hex) | erase mask | overlaid\n");
|
||||
seq_puts(s, " ------------------+------------+----------\n");
|
||||
for (i = 0; i < erase_map->n_regions; i++) {
|
||||
u64 start = region[i].offset;
|
||||
u64 end = start + region[i].size - 1;
|
||||
u8 erase_mask = region[i].erase_mask;
|
||||
u8 flags = region[i].flags;
|
||||
|
||||
seq_printf(s, " %08llx-%08llx | [%c%c%c%c] | %s\n",
|
||||
start, end,
|
||||
@ -156,7 +155,7 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
|
||||
erase_mask & BIT(1) ? '1' : ' ',
|
||||
erase_mask & BIT(2) ? '2' : ' ',
|
||||
erase_mask & BIT(3) ? '3' : ' ',
|
||||
flags & SNOR_OVERLAID_REGION ? "overlaid" : "");
|
||||
region[i].overlaid ? "yes" : "no");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -800,11 +800,6 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void spi_nor_region_mark_overlay(struct spi_nor_erase_region *region)
|
||||
{
|
||||
region->flags |= SNOR_OVERLAID_REGION;
|
||||
}
|
||||
|
||||
/**
|
||||
* spi_nor_region_check_overlay() - set overlay bit when the region is overlaid
|
||||
* @region: pointer to a structure that describes a SPI NOR erase region
|
||||
@ -822,7 +817,7 @@ spi_nor_region_check_overlay(struct spi_nor_erase_region *region,
|
||||
if (!(erase[i].size && erase_type & BIT(erase[i].idx)))
|
||||
continue;
|
||||
if (region->size & erase[i].size_mask) {
|
||||
spi_nor_region_mark_overlay(region);
|
||||
region->overlaid = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user