diff options
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.24/1246-fix-glamo-mci-possible-timeout-overflow.patch.patch')
-rw-r--r-- | target/linux/s3c24xx/patches-2.6.24/1246-fix-glamo-mci-possible-timeout-overflow.patch.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.24/1246-fix-glamo-mci-possible-timeout-overflow.patch.patch b/target/linux/s3c24xx/patches-2.6.24/1246-fix-glamo-mci-possible-timeout-overflow.patch.patch new file mode 100644 index 0000000000..36ada8d04f --- /dev/null +++ b/target/linux/s3c24xx/patches-2.6.24/1246-fix-glamo-mci-possible-timeout-overflow.patch.patch @@ -0,0 +1,58 @@ +From 87ffb9bd9691230e919a306979217e572fd02690 Mon Sep 17 00:00:00 2001 +From: Andy Green <andy@openmoko.com> +Date: Thu, 24 Jul 2008 00:04:44 +0100 +Subject: [PATCH] fix-glamo-mci-possible-timeout-overflow.patch + +The MMC stack hands us a timeout calibrated in SD_CLK clocks, but the +Glamo can only deal with up to 65520 clocks of timeout. If the stack +handed us a request bigger than this, it would just wrap and the +timeout we actually used would be way too short. + +With this patch if that happens, we use the longest timeout we can, +65520 clocks and give it our best shot. + +Signed-off-by: Andy Green <andy@openmoko.com> +--- + drivers/mfd/glamo/glamo-mci.c | 19 ++++++++++--------- + 1 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c +index 45b0afc..264a6bc 100644 +--- a/drivers/mfd/glamo/glamo-mci.c ++++ b/drivers/mfd/glamo/glamo-mci.c +@@ -338,6 +338,7 @@ static int glamo_mci_send_command(struct glamo_mci_host *host, + { + u8 u8a[6]; + u16 fire = 0; ++ u16 timeout = 0xfff; /* max glamo MMC timeout, in units of 16 clocks */ + + /* if we can't do it, reject as busy */ + if (!readw_dly(host->base + GLAMO_REG_MMC_RB_STAT1) & +@@ -447,15 +448,15 @@ static int glamo_mci_send_command(struct glamo_mci_host *host, + fire |= GLAMO_FIRE_MMC_CC_BASIC; /* "basic command" */ + break; + } +- /* enforce timeout */ +- if (cmd->data) { +- if (cmd->data->timeout_clks) +- writew_dly(cmd->data->timeout_clks >> 4, /* / 16 clks */ +- host->base + GLAMO_REG_MMC_TIMEOUT); +- else +- writew_dly(0xfff, host->base + GLAMO_REG_MMC_TIMEOUT); +- } else +- writew(0xfff, host->base + GLAMO_REG_MMC_TIMEOUT); ++ /* enforce timeout, clipping at default 65520 clocks if larger */ ++ if (cmd->data) ++ /* so long as there is one... */ ++ if (cmd->data->timeout_clks && ++ /* ... and it is not longer than we can handle */ ++ (cmd->data->timeout_clks <= 0xffff)) ++ timeout = cmd->data->timeout_clks >> 4; /* / 16 clks */ ++ ++ writew(timeout, host->base + GLAMO_REG_MMC_TIMEOUT); + + /* Generate interrupt on txfer */ + writew_dly((readw_dly(host->base + GLAMO_REG_MMC_BASIC) & 0x3e) | +-- +1.5.6.5 + |