Skip to content
Snippets Groups Projects
Commit 9b1f942c authored by Rabin Vincent's avatar Rabin Vincent Committed by Andy Fleming
Browse files

mmc: use lldiv to fix arm eabi build


The generic MMC core uses direct long long divisions, which do not build
with ARM EABI toolchains.  Use lldiv() instead, which works everywhere.

Signed-off-by: default avatarRabin Vincent <rabin@rab.in>
parent e85649c7
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <malloc.h> #include <malloc.h>
#include <linux/list.h> #include <linux/list.h>
#include <mmc.h> #include <mmc.h>
#include <div64.h>
static struct list_head mmc_devices; static struct list_head mmc_devices;
static int cur_dev_num = -1; static int cur_dev_num = -1;
...@@ -155,8 +156,8 @@ int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size) ...@@ -155,8 +156,8 @@ int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size)
char *buffer; char *buffer;
int i; int i;
int blklen = mmc->read_bl_len; int blklen = mmc->read_bl_len;
int startblock = src / blklen; int startblock = lldiv(src, mmc->read_bl_len);
int endblock = (src + size - 1) / blklen; int endblock = lldiv(src + size - 1, mmc->read_bl_len);
int err = 0; int err = 0;
/* Make a buffer big enough to hold all the blocks we might read */ /* Make a buffer big enough to hold all the blocks we might read */
...@@ -789,7 +790,7 @@ int mmc_startup(struct mmc *mmc) ...@@ -789,7 +790,7 @@ int mmc_startup(struct mmc *mmc)
mmc->block_dev.lun = 0; mmc->block_dev.lun = 0;
mmc->block_dev.type = 0; mmc->block_dev.type = 0;
mmc->block_dev.blksz = mmc->read_bl_len; mmc->block_dev.blksz = mmc->read_bl_len;
mmc->block_dev.lba = mmc->capacity/mmc->read_bl_len; mmc->block_dev.lba = lldiv(mmc->capacity, mmc->read_bl_len);
sprintf(mmc->block_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x%02x", sprintf(mmc->block_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x%02x",
mmc->cid[0], mmc->cid[1], mmc->cid[2], mmc->cid[0], mmc->cid[1], mmc->cid[2],
mmc->cid[9], mmc->cid[10], mmc->cid[11], mmc->cid[12]); mmc->cid[9], mmc->cid[10], mmc->cid[11], mmc->cid[12]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment