summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-07-02 10:58:32 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-02 10:58:32 +0200
commita3251562dbdc8dda29da84ac1ab271e927dc8ae0 (patch)
tree8335db3837ca1a04dc81730c0a40e4edbf467179 /drivers
parent9d0b51ea7e5b3fece57f91e17349b79a5b4b37e7 (diff)
parentcfcfc66d5486c2061316ebcdf32ef2f1ecbda433 (diff)
downloadbarebox-a3251562dbdc8dda29da84ac1ab271e927dc8ae0.tar.gz
barebox-a3251562dbdc8dda29da84ac1ab271e927dc8ae0.tar.xz
Merge branch 'for-next/64bit'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/disk_ata_drive.c2
-rw-r--r--drivers/base/driver.c2
-rw-r--r--drivers/eeprom/at25.c8
-rw-r--r--drivers/mfd/lp3972.c2
-rw-r--r--drivers/mfd/mc13xxx.c4
-rw-r--r--drivers/mfd/mc34704.c4
-rw-r--r--drivers/mfd/mc34708.c6
-rw-r--r--drivers/mfd/mc9sdz60.c4
-rw-r--r--drivers/mfd/twl-core.c4
-rw-r--r--drivers/mtd/core.c20
-rw-r--r--drivers/mtd/mtdoob.c3
-rw-r--r--drivers/mtd/mtdraw.c9
-rw-r--r--drivers/mtd/nand/nand-bb.c30
-rw-r--r--drivers/mtd/ubi/cdev.c8
-rw-r--r--drivers/net/miidev.c4
-rw-r--r--drivers/nor/cfi_flash.c18
-rw-r--r--drivers/nor/m25p80.c16
17 files changed, 80 insertions, 64 deletions
diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 4602af3c0d..d5c583790c 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -231,7 +231,7 @@ static void __maybe_unused ata_dump_id(uint16_t *id)
*/
static void ata_fix_endianess(uint16_t *buf, unsigned wds)
{
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
unsigned u;
for (u = 0; u < wds; u++)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 81cedca1db..a5c6fb9293 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -339,7 +339,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
for (i = 0; i < depth + 1; i++)
printf(" ");
- printf("`---- 0x%08lx-0x%08lx: /dev/%s\n",
+ printf("`---- 0x%08llx-0x%08llx: /dev/%s\n",
cdev->offset,
cdev->offset + cdev->size - 1,
cdev->name);
diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 8a979d53a1..03d191eb90 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -67,7 +67,7 @@ struct at25_data {
static ssize_t at25_ee_read(struct cdev *cdev,
void *buf,
size_t count,
- ulong offset,
+ loff_t offset,
ulong flags)
{
u8 command[EE_MAXADDRLEN + 1];
@@ -117,7 +117,7 @@ static ssize_t at25_ee_read(struct cdev *cdev,
*/
status = spi_sync(at25->spi, &m);
dev_dbg(at25->cdev.dev,
- "read %d bytes at %lu --> %d\n",
+ "read %d bytes at %llu --> %d\n",
count, offset, (int) status);
return status ? status : count;
@@ -126,7 +126,7 @@ static ssize_t at25_ee_read(struct cdev *cdev,
static ssize_t at25_ee_write(struct cdev *cdev,
const void *buf,
size_t count,
- ulong off,
+ loff_t off,
ulong flags)
{
ssize_t status = 0;
@@ -232,7 +232,7 @@ static ssize_t at25_ee_write(struct cdev *cdev,
return written ? written : status;
}
-static off_t at25_ee_lseek(struct cdev *cdev, off_t off)
+static loff_t at25_ee_lseek(struct cdev *cdev, loff_t off)
{
return off;
}
diff --git a/drivers/mfd/lp3972.c b/drivers/mfd/lp3972.c
index 98266990dc..0f3093bd15 100644
--- a/drivers/mfd/lp3972.c
+++ b/drivers/mfd/lp3972.c
@@ -58,7 +58,7 @@ static u32 lp_read_reg(struct lp_priv *lp, int reg)
return buf;
}
-static ssize_t lp_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t lp_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct lp_priv *priv = to_lp_priv(cdev);
int i = count;
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index f9477a3540..2934e9d9bd 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -160,7 +160,7 @@ int mc13xxx_set_bits(struct mc13xxx *mc13xxx, u8 reg, u32 mask, u32 val)
}
EXPORT_SYMBOL(mc13xxx_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc13xxx *priv = to_mc13xxx(cdev);
u32 *buf = _buf;
@@ -181,7 +181,7 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc13xxx *mc13xxx = to_mc13xxx(cdev);
const u32 *buf = _buf;
diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c
index a2171b35d1..20c01e2be6 100644
--- a/drivers/mfd/mc34704.c
+++ b/drivers/mfd/mc34704.c
@@ -65,7 +65,7 @@ int mc34704_reg_write(struct mc34704 *mc34704, u8 reg, u8 val)
EXPORT_SYMBOL(mc34704_reg_write)
static ssize_t mc34704_read(struct cdev *cdev, void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct mc34704 *priv = to_mc34704(cdev);
u8 *buf = _buf;
@@ -85,7 +85,7 @@ static ssize_t mc34704_read(struct cdev *cdev, void *_buf, size_t count,
}
static ssize_t mc34704_write(struct cdev *cdev, const void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct mc34704 *mc34704 = to_mc34704(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mfd/mc34708.c b/drivers/mfd/mc34708.c
index e7f40c02b7..02c58a997d 100644
--- a/drivers/mfd/mc34708.c
+++ b/drivers/mfd/mc34708.c
@@ -163,7 +163,8 @@ int mc34708_set_bits(struct mc34708 *mc34708, enum mc34708_reg reg, u32 mask, u3
}
EXPORT_SYMBOL(mc34708_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count,
+ loff_t offset, ulong flags)
{
struct mc34708 *priv = to_mc34708(cdev);
u32 *buf = _buf;
@@ -184,7 +185,8 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count,
+ loff_t offset, ulong flags)
{
struct mc34708 *mc34708 = to_mc34708(cdev);
const u32 *buf = _buf;
diff --git a/drivers/mfd/mc9sdz60.c b/drivers/mfd/mc9sdz60.c
index db208ec2db..0cd5007e1c 100644
--- a/drivers/mfd/mc9sdz60.c
+++ b/drivers/mfd/mc9sdz60.c
@@ -78,7 +78,7 @@ int mc9sdz60_set_bits(struct mc9sdz60 *mc9sdz60, enum mc9sdz60_reg reg, u8 mask,
}
EXPORT_SYMBOL(mc9sdz60_set_bits);
-static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc9sdz60 *mc9sdz60 = to_mc9sdz60(cdev);
u8 *buf = _buf;
@@ -97,7 +97,7 @@ static ssize_t mc_read(struct cdev *cdev, void *_buf, size_t count, ulong offset
return count;
}
-static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t mc_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
struct mc9sdz60 *mc9sdz60 = to_mc9sdz60(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index cb2c03dfca..20bde2cf89 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -112,7 +112,7 @@ int twlcore_set_bits(struct twlcore *twlcore, u16 reg, u8 mask, u8 val)
EXPORT_SYMBOL(twlcore_set_bits);
static ssize_t twl_read(struct cdev *cdev, void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct twlcore *priv = to_twlcore(cdev);
u8 *buf = _buf;
@@ -131,7 +131,7 @@ static ssize_t twl_read(struct cdev *cdev, void *_buf, size_t count,
}
static ssize_t twl_write(struct cdev *cdev, const void *_buf, size_t count,
- ulong offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct twlcore *twlcore = to_twlcore(cdev);
const u8 *buf = _buf;
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 87dcba6801..5510439a87 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -31,11 +31,12 @@
static LIST_HEAD(mtd_register_hooks);
static ssize_t mtd_read(struct cdev *cdev, void* buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = cdev->priv;
size_t retlen;
int ret;
+ unsigned long offset = _offset;
debug("mtd_read: 0x%08lx 0x%08x\n", offset, count);
@@ -64,13 +65,14 @@ static int all_ff(const void *buf, int len)
}
static ssize_t mtd_write(struct cdev* cdev, const void *buf, size_t _count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = cdev->priv;
size_t retlen, now;
int ret = 0;
void *wrbuf = NULL;
size_t count = _count;
+ unsigned long offset = _offset;
if (NOTALIGNED(offset)) {
printf("offset 0x%0lx not page aligned\n", offset);
@@ -123,16 +125,17 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
struct mtd_ecc_stats *ecc = buf;
#endif
struct region_info_user *reg = buf;
+ loff_t *offset = buf;
switch (request) {
case MEMGETBADBLOCK:
- dev_dbg(cdev->dev, "MEMGETBADBLOCK: 0x%08lx\n", (off_t)buf);
- ret = mtd->block_isbad(mtd, (off_t)buf);
+ dev_dbg(cdev->dev, "MEMGETBADBLOCK: 0x%08llx\n", *offset);
+ ret = mtd->block_isbad(mtd, *offset);
break;
#ifdef CONFIG_MTD_WRITE
case MEMSETBADBLOCK:
- dev_dbg(cdev->dev, "MEMSETBADBLOCK: 0x%08lx\n", (off_t)buf);
- ret = mtd->block_markbad(mtd, (off_t)buf);
+ dev_dbg(cdev->dev, "MEMSETBADBLOCK: 0x%08llx\n", *offset);
+ ret = mtd->block_markbad(mtd, *offset);
break;
#endif
case MEMGETINFO:
@@ -156,9 +159,10 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
#endif
case MEMGETREGIONINFO:
if (cdev->mtd) {
+ unsigned long size = cdev->size;
reg->offset = cdev->offset;
reg->erasesize = cdev->mtd->erasesize;
- reg->numblocks = cdev->size/reg->erasesize;
+ reg->numblocks = size / reg->erasesize;
reg->regionindex = cdev->mtd->index;
}
break;
@@ -170,7 +174,7 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
}
#ifdef CONFIG_MTD_WRITE
-static ssize_t mtd_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static ssize_t mtd_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct mtd_info *mtd = cdev->priv;
struct erase_info erase;
diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c
index be656a4d33..e4dd1a00c8 100644
--- a/drivers/mtd/mtdoob.c
+++ b/drivers/mtd/mtdoob.c
@@ -38,11 +38,12 @@ static struct mtd_info *to_mtd(struct cdev *cdev)
}
static ssize_t mtd_read_oob(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = to_mtd(cdev);
struct mtd_oob_ops ops;
int ret;
+ unsigned long offset = _offset;
if (count < mtd->oobsize)
return -EINVAL;
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 7abe2351a5..24f7358098 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -116,12 +116,13 @@ err:
}
static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtd_info *mtd = to_mtd(cdev);
ssize_t retlen = 0, ret = 1, toread;
ulong numpage;
int skip;
+ unsigned long offset = _offset;
numpage = offset / (mtd->writesize + mtd->oobsize);
skip = offset % (mtd->writesize + mtd->oobsize);
@@ -167,13 +168,14 @@ static void mtdraw_fillbuf(struct mtdraw *mtdraw, const void *src, int nbbytes)
}
static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
- ulong offset, ulong flags)
+ loff_t _offset, ulong flags)
{
struct mtdraw *mtdraw = to_mtdraw(cdev);
struct mtd_info *mtd = to_mtd(cdev);
int bsz = mtd->writesize + mtd->oobsize;
ulong numpage;
size_t retlen = 0, tofill;
+ unsigned long offset = _offset;
int ret = 0;
if (mtdraw->write_fill &&
@@ -220,10 +222,11 @@ static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
}
}
-static ssize_t mtdraw_erase(struct cdev *cdev, size_t count, ulong offset)
+static ssize_t mtdraw_erase(struct cdev *cdev, size_t count, loff_t _offset)
{
struct mtd_info *mtd = to_mtd(cdev);
struct erase_info erase;
+ unsigned long offset = _offset;
int ret;
offset = offset / (mtd->writesize + mtd->oobsize) * mtd->writesize;
diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index bd30438958..d27274924a 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -42,9 +42,9 @@ struct nand_bb {
struct mtd_info_user info;
- size_t raw_size;
- size_t size;
- off_t offset;
+ loff_t raw_size;
+ loff_t size;
+ loff_t offset;
unsigned long flags;
void *writebuf;
@@ -54,7 +54,7 @@ struct nand_bb {
};
static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct nand_bb *bb = cdev->priv;
struct cdev *parent = bb->cdev_parent;
@@ -63,18 +63,18 @@ static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
debug("%s %d %d\n", __func__, offset, count);
while(count) {
- ret = cdev_ioctl(parent, MEMGETBADBLOCK, (void *)bb->offset);
+ ret = cdev_ioctl(parent, MEMGETBADBLOCK, &bb->offset);
if (ret < 0)
return ret;
if (ret) {
- printf("skipping bad block at 0x%08lx\n", bb->offset);
+ printf("skipping bad block at 0x%08llx\n", bb->offset);
bb->offset += bb->info.erasesize;
continue;
}
now = min(count, (size_t)(bb->info.erasesize -
- (bb->offset % bb->info.erasesize)));
+ ((size_t)bb->offset % bb->info.erasesize)));
ret = cdev_read(parent, buf, now, bb->offset, 0);
if (ret < 0)
return ret;
@@ -96,10 +96,10 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
int ret, now;
struct cdev *parent = bb->cdev_parent;
void *buf = bb->writebuf;
- int cur_ofs = bb->offset & ~(BB_WRITEBUF_SIZE - 1);
+ off_t cur_ofs = bb->offset & ~(BB_WRITEBUF_SIZE - 1);
while (count) {
- ret = cdev_ioctl(parent, MEMGETBADBLOCK, (void *)cur_ofs);
+ ret = cdev_ioctl(parent, MEMGETBADBLOCK, &cur_ofs);
if (ret < 0)
return ret;
@@ -123,12 +123,12 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
}
static ssize_t nand_bb_write(struct cdev *cdev, const void *buf, size_t count,
- unsigned long offset, ulong flags)
+ loff_t offset, ulong flags)
{
struct nand_bb *bb = cdev->priv;
int bytes = count, now, wroffs, ret;
- debug("%s offset: 0x%08x count: 0x%08x\n", __func__, offset, count);
+ debug("%s offset: 0x%08llx count: 0x%08x\n", __func__, offset, count);
while (count) {
wroffs = bb->offset % BB_WRITEBUF_SIZE;
@@ -152,7 +152,7 @@ static ssize_t nand_bb_write(struct cdev *cdev, const void *buf, size_t count,
return bytes;
}
-static int nand_bb_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static int nand_bb_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct nand_bb *bb = cdev->priv;
@@ -197,11 +197,11 @@ static int nand_bb_close(struct cdev *cdev)
static int nand_bb_calc_size(struct nand_bb *bb)
{
- ulong pos = 0;
+ loff_t pos = 0;
int ret;
while (pos < bb->raw_size) {
- ret = cdev_ioctl(bb->cdev_parent, MEMGETBADBLOCK, (void *)pos);
+ ret = cdev_ioctl(bb->cdev_parent, MEMGETBADBLOCK, &pos);
if (ret < 0)
return ret;
if (!ret)
@@ -213,7 +213,7 @@ static int nand_bb_calc_size(struct nand_bb *bb)
return 0;
}
-static off_t nand_bb_lseek(struct cdev *cdev, off_t __offset)
+static loff_t nand_bb_lseek(struct cdev *cdev, loff_t __offset)
{
struct nand_bb *bb = cdev->priv;
unsigned long raw_pos = 0;
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 95bef1f9e0..c99b64db21 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -12,7 +12,7 @@ struct ubi_volume_cdev_priv {
};
static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
- unsigned long offset, unsigned long flags)
+ loff_t offset, unsigned long flags)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
struct ubi_volume *vol = priv->vol;
@@ -23,7 +23,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
loff_t offp = offset;
int usable_leb_size = vol->usable_leb_size;
- printf("%s: %d @ 0x%08lx\n", __func__, size, offset);
+ printf("%s: %d @ 0x%08llx\n", __func__, size, offset);
len = size > usable_leb_size ? usable_leb_size : size;
@@ -56,7 +56,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
}
static ssize_t ubi_volume_cdev_write(struct cdev* cdev, const void *buf,
- size_t size, unsigned long offset, unsigned long flags)
+ size_t size, loff_t offset, unsigned long flags)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
struct ubi_volume *vol = priv->vol;
@@ -121,7 +121,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
return 0;
}
-static off_t ubi_volume_cdev_lseek(struct cdev *cdev, off_t ofs)
+static loff_t ubi_volume_cdev_lseek(struct cdev *cdev, loff_t ofs)
{
struct ubi_volume_cdev_priv *priv = cdev->priv;
diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index f47fc9e65b..d23775b5a4 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -180,7 +180,7 @@ int miidev_print_status(struct mii_device *mdev)
return 0;
}
-static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, loff_t offset, ulong flags)
{
int i = count;
uint16_t *buf = _buf;
@@ -196,7 +196,7 @@ static ssize_t miidev_read(struct cdev *cdev, void *_buf, size_t count, ulong of
return count;
}
-static ssize_t miidev_write(struct cdev *cdev, const void *_buf, size_t count, ulong offset, ulong flags)
+static ssize_t miidev_write(struct cdev *cdev, const void *_buf, size_t count, loff_t offset, ulong flags)
{
int i = count;
const uint16_t *buf = _buf;
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 654e6470c1..16885c0af9 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -82,9 +82,9 @@ static void flash_add_byte (struct flash_info *info, cfiword_t * cword, uchar c)
return;
}
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
*cword = (*cword << 8) | c;
-#else
+#elif defined __LITTLE_ENDIAN
if (bankwidth_is_2(info))
*cword = (*cword >> 8) | (u16)c << 8;
@@ -92,6 +92,8 @@ static void flash_add_byte (struct flash_info *info, cfiword_t * cword, uchar c)
*cword = (*cword >> 8) | (u32)c << 24;
else if (bankwidth_is_8(info))
*cword = (*cword >> 8) | (u64)c << 56;
+#else
+#error "could not determine byte order"
#endif
}
@@ -167,7 +169,7 @@ static void flash_printqry (struct cfi_qry *qry)
uchar flash_read_uchar (struct flash_info *info, uint offset)
{
uchar *cp = flash_make_addr(info, 0, offset);
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined __LITTLE_ENDIAN
return flash_read8(cp);
#else
return flash_read8(cp + info->portwidth - 1);
@@ -195,7 +197,7 @@ static ulong flash_read_long (struct flash_info *info, flash_sect_t sect, uint o
debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
}
#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined __LITTLE_ENDIAN
retval = ((flash_read8(addr) << 16) |
(flash_read8(addr + info->portwidth) << 24) |
(flash_read8(addr + 2 * info->portwidth)) |
@@ -456,7 +458,7 @@ flash_sect_t find_sector (struct flash_info *info, ulong addr)
return sector;
}
-static int __cfi_erase(struct cdev *cdev, size_t count, unsigned long offset,
+static int __cfi_erase(struct cdev *cdev, size_t count, loff_t offset,
int verbose)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
@@ -491,7 +493,7 @@ out:
return ret;
}
-static int cfi_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static int cfi_erase(struct cdev *cdev, size_t count, loff_t offset)
{
return __cfi_erase(cdev, count, offset, 1);
}
@@ -628,7 +630,7 @@ static int flash_real_protect (struct flash_info *info, long sector, int prot)
return retcode;
}
-static int cfi_protect(struct cdev *cdev, size_t count, unsigned long offset, int prot)
+static int cfi_protect(struct cdev *cdev, size_t count, loff_t offset, int prot)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
unsigned long start, end;
@@ -651,7 +653,7 @@ out:
return ret;
}
-static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, unsigned long offset, ulong flags)
+static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
{
struct flash_info *finfo = (struct flash_info *)cdev->priv;
int ret;
diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c
index 77669c2808..14402270bc 100644
--- a/drivers/nor/m25p80.c
+++ b/drivers/nor/m25p80.c
@@ -194,13 +194,14 @@ static int erase_sector(struct m25p *flash, u32 offset)
* Erase an address range on the flash chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
-static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offset)
+static ssize_t m25p80_erase(struct cdev *cdev, size_t count, loff_t offset)
{
struct m25p *flash = cdev->priv;
u32 addr, len;
u32 start_sector;
u32 end_sector;
u32 progress = 0;
+ int eraseshift = ffs(flash->erasesize) - 1;
dev_dbg(&flash->spi->dev, "%s %s 0x%llx, len %lld\n",
__func__, "at", (long long)offset, (long long)count);
@@ -212,8 +213,8 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
addr = offset;
len = count;
- start_sector = offset / flash->erasesize;
- end_sector = (offset + count - 1) / flash->erasesize;
+ start_sector = offset >> eraseshift;
+ end_sector = (offset + count - 1) >> eraseshift;
init_progression_bar(end_sector - start_sector + 1);
/* whole-chip erase? */
@@ -250,7 +251,8 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse
return 0;
}
-ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
+ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, loff_t offset,
+ ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];
@@ -302,7 +304,8 @@ ssize_t m25p80_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ul
return retlen;
}
-ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count,
+ loff_t offset, ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];
@@ -381,7 +384,8 @@ ssize_t m25p80_write(struct cdev *cdev, const void *buf, size_t count, ulong off
return retlen;
}
#ifdef CONFIG_MTD_SST25L
-ssize_t sst_write(struct cdev *cdev, const void *buf, size_t count, ulong offset, ulong flags)
+ssize_t sst_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset,
+ ulong flags)
{
struct m25p *flash = cdev->priv;
struct spi_transfer t[2];