summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/macronix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/spi/macronix.c')
-rw-r--r--drivers/mtd/spi/macronix.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 4155d4d..a0512d1 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -177,11 +177,7 @@ static int macronix_write(struct spi_flash *flash,
int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
{
- struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
- return spi_flash_cmd_erase(flash, CMD_MX25XX_BE,
- mcx->params->page_size * mcx->params->pages_per_sector *
- mcx->params->sectors_per_block,
- offset, len);
+ return spi_flash_cmd_erase(flash, CMD_MX25XX_BE, offset, len);
}
struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
@@ -215,12 +211,9 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
mcx->flash.write = macronix_write;
mcx->flash.erase = macronix_erase;
mcx->flash.read = spi_flash_cmd_read_fast;
- mcx->flash.size = params->page_size * params->pages_per_sector
- * params->sectors_per_block * params->nr_blocks;
-
- printf("SF: Detected %s with page size %u, total ",
- params->name, params->page_size);
- print_size(mcx->flash.size, "\n");
+ mcx->flash.sector_size = params->page_size * params->pages_per_sector
+ * params->sectors_per_block;
+ mcx->flash.size = mcx->flash.sector_size * params->nr_blocks;
return &mcx->flash;
}