Commit 783ed81f authored by Artem B. Bityutskiy's avatar Artem B. Bityutskiy

[MTD] assume mtd->writesize is 1 for NOR flashes

Signed-off-by: Artem B. Bityitskiy
parent f9068876
...@@ -730,6 +730,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -730,6 +730,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
offset += dev_size; offset += dev_size;
} }
mtd->type = MTD_NORFLASH; mtd->type = MTD_NORFLASH;
mtd->writesize = 1;
mtd->flags = MTD_CAP_NORFLASH; mtd->flags = MTD_CAP_NORFLASH;
mtd->name = map->name; mtd->name = map->name;
mtd->erase = amd_flash_erase; mtd->erase = amd_flash_erase;
......
...@@ -236,6 +236,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) ...@@ -236,6 +236,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
mtd->resume = cfi_amdstd_resume; mtd->resume = cfi_amdstd_resume;
mtd->flags = MTD_CAP_NORFLASH; mtd->flags = MTD_CAP_NORFLASH;
mtd->name = map->name; mtd->name = map->name;
mtd->writesize = 1;
if (cfi->cfi_mode==CFI_MODE_CFI){ if (cfi->cfi_mode==CFI_MODE_CFI){
unsigned char bootloc; unsigned char bootloc;
......
...@@ -140,6 +140,7 @@ static struct mtd_info *sharp_probe(struct map_info *map) ...@@ -140,6 +140,7 @@ static struct mtd_info *sharp_probe(struct map_info *map)
mtd->suspend = sharp_suspend; mtd->suspend = sharp_suspend;
mtd->resume = sharp_resume; mtd->resume = sharp_resume;
mtd->flags = MTD_CAP_NORFLASH; mtd->flags = MTD_CAP_NORFLASH;
mtd->writesize = 1;
mtd->name = map->name; mtd->name = map->name;
memset(sharp, 0, sizeof(*sharp)); memset(sharp, 0, sizeof(*sharp));
......
...@@ -635,6 +635,7 @@ int __init lart_flash_init (void) ...@@ -635,6 +635,7 @@ int __init lart_flash_init (void)
printk ("%s: This looks like a LART board to me.\n",module_name); printk ("%s: This looks like a LART board to me.\n",module_name);
mtd.name = module_name; mtd.name = module_name;
mtd.type = MTD_NORFLASH; mtd.type = MTD_NORFLASH;
mtd.writesize = 1;
mtd.flags = MTD_CAP_NORFLASH; mtd.flags = MTD_CAP_NORFLASH;
mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN; mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN;
mtd.erasesize = FLASH_BLOCKSIZE_MAIN; mtd.erasesize = FLASH_BLOCKSIZE_MAIN;
......
...@@ -465,6 +465,7 @@ static int __devinit m25p_probe(struct spi_device *spi) ...@@ -465,6 +465,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
flash->mtd.name = spi->dev.bus_id; flash->mtd.name = spi->dev.bus_id;
flash->mtd.type = MTD_NORFLASH; flash->mtd.type = MTD_NORFLASH;
flash->mtd.writesize = 1;
flash->mtd.flags = MTD_CAP_NORFLASH; flash->mtd.flags = MTD_CAP_NORFLASH;
flash->mtd.size = info->sector_size * info->n_sectors; flash->mtd.size = info->sector_size * info->n_sectors;
flash->mtd.erasesize = info->sector_size; flash->mtd.erasesize = info->sector_size;
......
...@@ -106,6 +106,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, ...@@ -106,6 +106,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
mtd->type = MTD_GENERIC_TYPE; mtd->type = MTD_GENERIC_TYPE;
mtd->flags = MTD_CAP_RAM; mtd->flags = MTD_CAP_RAM;
mtd->size = size; mtd->size = size;
mtd->writesize = 1;
mtd->erasesize = MTDRAM_ERASE_SIZE; mtd->erasesize = MTDRAM_ERASE_SIZE;
mtd->priv = mapped_address; mtd->priv = mapped_address;
......
...@@ -47,6 +47,7 @@ int add_mtd_device(struct mtd_info *mtd) ...@@ -47,6 +47,7 @@ int add_mtd_device(struct mtd_info *mtd)
{ {
int i; int i;
BUG_ON(mtd->writesize == 0);
mutex_lock(&mtd_table_mutex); mutex_lock(&mtd_table_mutex);
for (i=0; i < MAX_MTD_DEVICES; i++) for (i=0; i < MAX_MTD_DEVICES; i++)
......
...@@ -110,9 +110,12 @@ struct mtd_info { ...@@ -110,9 +110,12 @@ struct mtd_info {
* information below if they desire * information below if they desire
*/ */
u_int32_t erasesize; u_int32_t erasesize;
/* Smallest availlable size for writing to the device. For NAND, /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
* this is the page size, for some NOR chips, the size of ECC * though individual bits can be cleared), in case of NAND flash it is
* covered blocks. * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
* it is of ECC block size, etc. It is illegal to have writesize = 0.
* Any driver registering a struct mtd_info must ensure a writesize of
* 1 or larger.
*/ */
u_int32_t writesize; u_int32_t writesize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment