diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/core.c | 2 | ||||
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 5 | ||||
-rw-r--r-- | drivers/mtd/devices/mtd_dataflash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdoob.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdraw.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_mxs.c | 32 | ||||
-rw-r--r-- | drivers/mtd/partition.c | 4 | ||||
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 2 |
8 files changed, 36 insertions, 15 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 36a363fa37..c97c8c1403 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -401,7 +401,7 @@ int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id) mtd->cdev.mtd = mtd; if (IS_ENABLED(CONFIG_PARAMETER)) { - dev_add_param_int_ro(&mtd->class_dev, "size", mtd->size, "%u"); + dev_add_param_int_ro(&mtd->class_dev, "size", mtd->size, "%llu"); dev_add_param_int_ro(&mtd->class_dev, "erasesize", mtd->erasesize, "%u"); dev_add_param_int_ro(&mtd->class_dev, "writesize", mtd->oobsize, "%u"); dev_add_param_int_ro(&mtd->class_dev, "oobsize", mtd->oobsize, "%u"); diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 56c69f35c0..50e04548e9 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -268,8 +268,9 @@ static int erase_sector(struct m25p *flash, u32 offset, u32 command) static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr) { struct m25p *flash = mtd_to_m25p(mtd); - u32 addr, len; + u32 addr; uint32_t rem; + uint64_t len; dev_dbg(&flash->spi->dev, "%s at 0x%llx, len %lld\n", __func__, (long long)instr->addr, @@ -897,7 +898,7 @@ static int m25p_probe(struct device_d *dev) flash->mtd.type = MTD_NORFLASH; flash->mtd.writesize = 1; flash->mtd.flags = MTD_CAP_NORFLASH; - flash->mtd.size = info->sector_size * info->n_sectors; + flash->mtd.size = (uint64_t)info->sector_size * info->n_sectors; flash->mtd.erase = m25p80_erase; flash->mtd.read = m25p80_read; diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index cdc0120c53..fa31b61464 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -625,7 +625,7 @@ add_dataflash_otp(struct spi_device *spi, char *name, device = &priv->mtd; device->name = (pdata && pdata->name) ? pdata->name : "dataflash"; - device->size = nr_pages * pagesize; + device->size = nr_pages * (uint64_t)pagesize; device->erasesize = pagesize; device->writesize = pagesize; device->type = MTD_DATAFLASH; diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c index b9cac2ae69..10d17e90d2 100644 --- a/drivers/mtd/mtdoob.c +++ b/drivers/mtd/mtdoob.c @@ -78,7 +78,7 @@ static int add_mtdoob_device(struct mtd_info *mtd, char *devname, void **priv) mtdoob = xzalloc(sizeof(*mtdoob)); mtdoob->cdev.ops = &mtd_ops_oob; - mtdoob->cdev.size = (mtd->size / mtd->writesize) * mtd->oobsize; + mtdoob->cdev.size = mtd_div_by_wb(mtd->size, mtd) * mtd->oobsize; mtdoob->cdev.name = asprintf("%s_oob%d", devname, mtd->class_dev.id); mtdoob->cdev.priv = mtdoob; mtdoob->cdev.dev = &mtd->class_dev; diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c index 006b28f9b2..c25e4062ee 100644 --- a/drivers/mtd/mtdraw.c +++ b/drivers/mtd/mtdraw.c @@ -293,7 +293,7 @@ static int add_mtdraw_device(struct mtd_info *mtd, char *devname, void **priv) mtdraw->mtd = mtd; mtdraw->cdev.ops = (struct file_operations *)&mtd_raw_fops; - mtdraw->cdev.size = mtd->size / mtd->writesize * + mtdraw->cdev.size = mtd_div_by_wb(mtd->size, mtd) * (mtd->writesize + mtd->oobsize); mtdraw->cdev.name = asprintf("%s.raw", mtd->cdev.name); mtdraw->cdev.priv = mtdraw; diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c index d1e4b5717d..b06b558b08 100644 --- a/drivers/mtd/nand/nand_mxs.c +++ b/drivers/mtd/nand/nand_mxs.c @@ -33,6 +33,7 @@ #include <dma/apbh-dma.h> #include <stmp-device.h> #include <asm/mmu.h> +#include <mach/generic.h> #define MX28_BLOCK_SFTRST (1 << 31) #define MX28_BLOCK_CLKGATE (1 << 30) @@ -233,18 +234,31 @@ static uint32_t mxs_nand_aux_status_offset(void) static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, uint32_t page_oob_size) { + int ecc_chunk_count = mxs_nand_ecc_chunk_cnt(page_data_size); + int ecc_strength = 0; + int gf_len = 13; /* length of Galois Field for non-DDR nand */ + + /* + * Possibly this if-else calculation may be removed since + * ecc_strength calculated after it is taken from kernel driver + * and therefore should work for all cases. But it was tested only + * on devices with {data_size = 2046, oob_size = 64} and + * {data_size = 4096, oob_size = 224} configuration. + */ if (page_data_size == 2048) return 8; - - if (page_data_size == 4096) { + else if (page_data_size == 4096) { if (page_oob_size == 128) return 8; - if (page_oob_size == 218) return 16; } - return 0; + ecc_strength = ((page_oob_size - MXS_NAND_METADATA_SIZE) * 8) + / (gf_len * ecc_chunk_count); + + /* We need the minor even number. */ + return rounddown(ecc_strength, 2); } static inline uint32_t mxs_nand_get_mark_offset(uint32_t page_data_size, @@ -427,7 +441,13 @@ static int mxs_nand_device_ready(struct mtd_info *mtd) if (nand_info->version > GPMI_VERSION_TYPE_MX23) { tmp = readl(gpmi_regs + GPMI_STAT); - tmp >>= (GPMI_STAT_READY_BUSY_OFFSET + nand_info->cur_chip); + /* i.MX6 has only one R/B actual pin, so if there are several + R/B signals they must be all connected to this pin */ + if (cpu_is_mx6()) + tmp >>= GPMI_STAT_READY_BUSY_OFFSET; + else + tmp >>= (GPMI_STAT_READY_BUSY_OFFSET + + nand_info->cur_chip); } else { tmp = readl(gpmi_regs + GPMI_DEBUG); tmp >>= (GPMI_DEBUG_READY0_OFFSET + nand_info->cur_chip); @@ -1304,7 +1324,7 @@ static int mxs_nand_probe(struct device_d *dev) nand->ecc.strength = 8; /* first scan to find the device and get the page size */ - err = nand_scan_ident(mtd, 1, NULL); + err = nand_scan_ident(mtd, 4, NULL); if (err) goto err2; diff --git a/drivers/mtd/partition.c b/drivers/mtd/partition.c index 351c5831b0..720c2adab3 100644 --- a/drivers/mtd/partition.c +++ b/drivers/mtd/partition.c @@ -75,8 +75,8 @@ static int mtd_part_block_markbad(struct mtd_info *mtd, loff_t ofs) return res; } -struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset, size_t size, - unsigned long flags, const char *name) +struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset, + uint64_t size, unsigned long flags, const char *name) { struct mtd_info *part; int start = 0, end = 0, i; diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 4b8eb4c5cf..dcd138f553 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -222,7 +222,7 @@ static int ubi_cdev_ioctl(struct cdev *cdev, int cmd, void *buf) break; case UBI_IOCMKVOL: if (!req->bytes) - req->bytes = ubi->avail_pebs * ubi->leb_size; + req->bytes = (__s64)ubi->avail_pebs * ubi->leb_size; return ubi_create_volume(ubi, req); }; |