Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
On Wed, Mar 12, 2014 at 09:51:46PM +0100, Alexander Aring wrote: > Hi Sascha, > > On Wed, Mar 12, 2014 at 09:28:48PM +0100, Sascha Hauer wrote: > > On Mon, Mar 10, 2014 at 02:39:49PM +0300, Dmitry Lavnikevich wrote: > > > MTD internal API presently uses 32-bit values to represent device > > > size. This patch updates them to 64-bits but leaves the external API > > > unchanged. > > > > > > In general, changing from 32-bit to 64-bit values cause little > > > or no changes to the majority of the code with the following > > > exceptions: > > > - printk message formats; > > > - division and modulus of 64-bit values (mtd_div_by_wb, > > > mtd_div_by_eb may be used in some of such cases). > > > > > > Was tested on phyFLEX i.MX6. > > > > > > > changed master_offset to 64bit aswell and applied this series. > > > ok, cool! > > But.. damn it there is still a ugly comment in lib/libmtd.c: > > "NOTE: No support for 64 bit sizes yet!" Maybe this should be removed by somebody who has tested this code with devices > 4GB. I don't have the hardware for this. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
Hi Sascha, On Wed, Mar 12, 2014 at 09:28:48PM +0100, Sascha Hauer wrote: > On Mon, Mar 10, 2014 at 02:39:49PM +0300, Dmitry Lavnikevich wrote: > > MTD internal API presently uses 32-bit values to represent device > > size. This patch updates them to 64-bits but leaves the external API > > unchanged. > > > > In general, changing from 32-bit to 64-bit values cause little > > or no changes to the majority of the code with the following > > exceptions: > > - printk message formats; > > - division and modulus of 64-bit values (mtd_div_by_wb, > > mtd_div_by_eb may be used in some of such cases). > > > > Was tested on phyFLEX i.MX6. > > > > changed master_offset to 64bit aswell and applied this series. > ok, cool! But.. damn it there is still a ugly comment in lib/libmtd.c: "NOTE: No support for 64 bit sizes yet!" hehe. :-) - Alex ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
On Mon, Mar 10, 2014 at 02:39:49PM +0300, Dmitry Lavnikevich wrote: > MTD internal API presently uses 32-bit values to represent device > size. This patch updates them to 64-bits but leaves the external API > unchanged. > > In general, changing from 32-bit to 64-bit values cause little > or no changes to the majority of the code with the following > exceptions: > - printk message formats; > - division and modulus of 64-bit values (mtd_div_by_wb, > mtd_div_by_eb may be used in some of such cases). > > Was tested on phyFLEX i.MX6. > changed master_offset to 64bit aswell and applied this series. Thanks Sascha > Signed-off-by: Dmitry Lavnikevich > Signed-off-by: Grigory Milev > --- > commands/nandtest.c | 2 +- > commands/partition.c| 11 ++- > drivers/mtd/core.c | 2 +- > drivers/mtd/devices/m25p80.c| 5 +++-- > drivers/mtd/devices/mtd_dataflash.c | 2 +- > drivers/mtd/mtdoob.c| 2 +- > drivers/mtd/mtdraw.c| 2 +- > include/linux/mtd/mtd-abi.h | 12 +++- > include/linux/mtd/mtd.h | 9 - > lib/libmtd.c| 10 +- > 10 files changed, 38 insertions(+), 19 deletions(-) > > diff --git a/commands/nandtest.c b/commands/nandtest.c > index 0da5444..c64f244 100644 > --- a/commands/nandtest.c > +++ b/commands/nandtest.c > @@ -277,7 +277,7 @@ static int do_nandtest(int argc, char *argv[]) > } > if (length + flash_offset > meminfo.size) { > printf("Length 0x%08llx + offset 0x%08llx exceeds " > - "device size 0x%08x\n", length, > + "device size 0x%08llx\n", length, > flash_offset, meminfo.size); > goto err; > } > diff --git a/commands/partition.c b/commands/partition.c > index 6d37471..f825722 100644 > --- a/commands/partition.c > +++ b/commands/partition.c > @@ -42,10 +42,11 @@ > #define PART_ADD_DEVNAME (1 << 0) > > static int mtd_part_do_parse_one(char *devname, const char *partstr, > - char **endp, unsigned long *offset, > - off_t devsize, size_t *retsize, unsigned int > pflags) > + char **endp, loff_t *offset, > + loff_t devsize, size_t *retsize, > + unsigned int pflags) > { > - ulong size; > + loff_t size; > char *end; > char buf[PATH_MAX] = {}; > unsigned long flags = 0; > @@ -114,8 +115,8 @@ static int do_addpart(int argc, char *argv[]) > { > char *devname; > char *endp; > - unsigned long offset = 0; > - off_t devsize; > + loff_t offset = 0; > + loff_t devsize; > struct stat s; > int opt; > unsigned int flags = PART_ADD_DEVNAME; > diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c > index 6db1c6d..7efb03c 100644 > --- a/drivers/mtd/core.c > +++ b/drivers/mtd/core.c > @@ -397,7 +397,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 9594011..757a717 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -273,8 +273,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, > @@ -896,7 +897,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 cdc0120..fa31b61 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; >
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
On Tue, Mar 11, 2014 at 08:50:44AM +0100, Alexander Aring wrote: > On Tue, Mar 11, 2014 at 06:29:22AM +0100, Sascha Hauer wrote: > > > offset but we should do it right at first time. > > > > Yes, right. We should make this uint64_t. > > > > There are also more things which needs a uint64_t like the offset > parameter of libmtd_* functions. :-/ The libmtd functions should be 64bit already. The remaining bits are in Dmitrys series. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
On Tue, Mar 11, 2014 at 06:29:22AM +0100, Sascha Hauer wrote: > > offset but we should do it right at first time. > > Yes, right. We should make this uint64_t. > There are also more things which needs a uint64_t like the offset parameter of libmtd_* functions. :-/ - Alex ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
On Mon, Mar 10, 2014 at 09:02:15AM +0100, Alexander Aring wrote: > Hi Sascha, > > we talked some time ago about >= 4GB mtd support. This patch series add > only a size for uint64_t. But then we also need to change That even wasn't so long ago ;) > > uint32_t master_offset; > > in mtd_info to: > > uint64_t master_offset; > > otherwise we can't create mtd partitions with a uint64_t offset. Or I am > wrong with that? I mean... maybe they don't want to make a uint64_t > offset but we should do it right at first time. Yes, right. We should make this uint64_t. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/5] mtd: Update internal API to support 64-bit device size
MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats; - division and modulus of 64-bit values (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich Signed-off-by: Grigory Milev --- commands/nandtest.c | 2 +- commands/partition.c| 11 ++- drivers/mtd/core.c | 2 +- drivers/mtd/devices/m25p80.c| 5 +++-- drivers/mtd/devices/mtd_dataflash.c | 2 +- drivers/mtd/mtdoob.c| 2 +- drivers/mtd/mtdraw.c| 2 +- include/linux/mtd/mtd-abi.h | 12 +++- include/linux/mtd/mtd.h | 9 - lib/libmtd.c| 10 +- 10 files changed, 38 insertions(+), 19 deletions(-) diff --git a/commands/nandtest.c b/commands/nandtest.c index 0da5444..c64f244 100644 --- a/commands/nandtest.c +++ b/commands/nandtest.c @@ -277,7 +277,7 @@ static int do_nandtest(int argc, char *argv[]) } if (length + flash_offset > meminfo.size) { printf("Length 0x%08llx + offset 0x%08llx exceeds " - "device size 0x%08x\n", length, + "device size 0x%08llx\n", length, flash_offset, meminfo.size); goto err; } diff --git a/commands/partition.c b/commands/partition.c index 6d37471..f825722 100644 --- a/commands/partition.c +++ b/commands/partition.c @@ -42,10 +42,11 @@ #define PART_ADD_DEVNAME (1 << 0) static int mtd_part_do_parse_one(char *devname, const char *partstr, -char **endp, unsigned long *offset, -off_t devsize, size_t *retsize, unsigned int pflags) +char **endp, loff_t *offset, +loff_t devsize, size_t *retsize, +unsigned int pflags) { - ulong size; + loff_t size; char *end; char buf[PATH_MAX] = {}; unsigned long flags = 0; @@ -114,8 +115,8 @@ static int do_addpart(int argc, char *argv[]) { char *devname; char *endp; - unsigned long offset = 0; - off_t devsize; + loff_t offset = 0; + loff_t devsize; struct stat s; int opt; unsigned int flags = PART_ADD_DEVNAME; diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 6db1c6d..7efb03c 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -397,7 +397,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 9594011..757a717 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -273,8 +273,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, @@ -896,7 +897,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 cdc0120..fa31b61 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/d
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
Hello Sascha, eyah, I've had some problems sending mails with git send-email through my proxy so tried to use thunderbird to pass patches outside. Which apparently did some improvisation on them :) Anyway, I have fixed my sendmail and will resend patches soon. Best regards, Lavnikevich Dmitry On 03/10/14 10:20, Sascha Hauer wrote: Hi Dmitry, On Fri, Mar 07, 2014 at 02:14:45PM +0300, Dmitry Lavnikevich wrote: MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats; - division and modulus of 64-bit values (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich Signed-off-by: Grigory Milev Your patches look all good. Unfortunately I can't apply them because your mailer wraps lines. diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 6db1c6d..7efb03c 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -397,7 +397,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"); For example here. flash->mtd.read = m25p80_read; diff --git a/drivers/mtd/devices/mtd_dataflash.c Here is one space too much before 'diff' diff --git a/include/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h index 11d51e2..c1ba55b 100644 --- a/include/linux/mtd/mtd-abi.h +++ b/include/linux/mtd/mtd-abi.h @@ -9,6 +9,8 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS +#include + Here also is one space too much. Could you try resending it using git-send-email? Sascha ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
Hi Sascha, we talked some time ago about >= 4GB mtd support. This patch series add only a size for uint64_t. But then we also need to change uint32_t master_offset; in mtd_info to: uint64_t master_offset; otherwise we can't create mtd partitions with a uint64_t offset. Or I am wrong with that? I mean... maybe they don't want to make a uint64_t offset but we should do it right at first time. - Alex ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] mtd: Update internal API to support 64-bit device size
Hi Dmitry, On Fri, Mar 07, 2014 at 02:14:45PM +0300, Dmitry Lavnikevich wrote: > MTD internal API presently uses 32-bit values to represent device > size. This patch updates them to 64-bits but leaves the external API > unchanged. > > In general, changing from 32-bit to 64-bit values cause little > or no changes to the majority of the code with the following > exceptions: > - printk message formats; > - division and modulus of 64-bit values (mtd_div_by_wb, > mtd_div_by_eb may be used in some of such cases). > > Was tested on phyFLEX i.MX6. > > Signed-off-by: Dmitry Lavnikevich > Signed-off-by: Grigory Milev Your patches look all good. Unfortunately I can't apply them because your mailer wraps lines. > diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c > index 6db1c6d..7efb03c 100644 > --- a/drivers/mtd/core.c > +++ b/drivers/mtd/core.c > @@ -397,7 +397,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"); For example here. > flash->mtd.read = m25p80_read; > diff --git a/drivers/mtd/devices/mtd_dataflash.c Here is one space too much before 'diff' > diff --git a/include/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h > index 11d51e2..c1ba55b 100644 > --- a/include/linux/mtd/mtd-abi.h > +++ b/include/linux/mtd/mtd-abi.h > @@ -9,6 +9,8 @@ > #ifndef DOXYGEN_SHOULD_SKIP_THIS > +#include > + Here also is one space too much. Could you try resending it using git-send-email? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/5] mtd: Update internal API to support 64-bit device size
MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats; - division and modulus of 64-bit values (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich Signed-off-by: Grigory Milev --- commands/nandtest.c | 2 +- commands/partition.c| 11 ++- drivers/mtd/core.c | 2 +- drivers/mtd/devices/m25p80.c| 5 +++-- drivers/mtd/devices/mtd_dataflash.c | 2 +- drivers/mtd/mtdoob.c| 2 +- drivers/mtd/mtdraw.c| 2 +- include/linux/mtd/mtd-abi.h | 12 +++- include/linux/mtd/mtd.h | 9 - lib/libmtd.c| 10 +- 10 files changed, 38 insertions(+), 19 deletions(-) diff --git a/commands/nandtest.c b/commands/nandtest.c index 0da5444..c64f244 100644 --- a/commands/nandtest.c +++ b/commands/nandtest.c @@ -277,7 +277,7 @@ static int do_nandtest(int argc, char *argv[]) } if (length + flash_offset > meminfo.size) { printf("Length 0x%08llx + offset 0x%08llx exceeds " - "device size 0x%08x\n", length, + "device size 0x%08llx\n", length, flash_offset, meminfo.size); goto err; } diff --git a/commands/partition.c b/commands/partition.c index 6d37471..f825722 100644 --- a/commands/partition.c +++ b/commands/partition.c @@ -42,10 +42,11 @@ #define PART_ADD_DEVNAME (1 << 0) static int mtd_part_do_parse_one(char *devname, const char *partstr, -char **endp, unsigned long *offset, -off_t devsize, size_t *retsize, unsigned int pflags) +char **endp, loff_t *offset, +loff_t devsize, size_t *retsize, +unsigned int pflags) { - ulong size; + loff_t size; char *end; char buf[PATH_MAX] = {}; unsigned long flags = 0; @@ -114,8 +115,8 @@ static int do_addpart(int argc, char *argv[]) { char *devname; char *endp; - unsigned long offset = 0; - off_t devsize; + loff_t offset = 0; + loff_t devsize; struct stat s; int opt; unsigned int flags = PART_ADD_DEVNAME; diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 6db1c6d..7efb03c 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -397,7 +397,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 9594011..757a717 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -273,8 +273,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, @@ -896,7 +897,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 cdc0120..fa31b61 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/mtdoo