summaryrefslogtreecommitdiffstats
path: root/drivers/nor/cfi_flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nor/cfi_flash.c')
-rw-r--r--drivers/nor/cfi_flash.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 654e647..16885c0 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;