aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/glamo
diff options
context:
space:
mode:
authorwarmcat <andy@warmcat.com>2008-11-19 17:09:33 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:09:33 +0000
commit939532cb22ecfdc9a04574f24941060c1d549f3d (patch)
tree540ea516dc2002a50c610936226eb8250e6e6468 /drivers/mfd/glamo
parent72389bf132fb8cb7c05b2e5b360e240676d53e4c (diff)
fix-glamo-mci-fake-reset-opcode-in-suspend.patch
Diffstat (limited to 'drivers/mfd/glamo')
-rw-r--r--drivers/mfd/glamo/glamo-core.c16
-rw-r--r--drivers/mfd/glamo/glamo-mci.c29
2 files changed, 30 insertions, 15 deletions
diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
index 2076e61ad71..4d8e47f3e1e 100644
--- a/drivers/mfd/glamo/glamo-core.c
+++ b/drivers/mfd/glamo/glamo-core.c
@@ -822,6 +822,8 @@ static void glamo_power(struct glamo_core *glamo,
{
spin_lock(&glamo->lock);
+ dev_dbg(&glamo->pdev->dev, "***** glamo_power -> %d\n", new_state);
+
switch (new_state) {
case GLAMO_POWER_ON:
/* power up PLL1 and PLL2 */
@@ -1026,13 +1028,6 @@ static int __init glamo_probe(struct platform_device *pdev)
glamo_mci_def_pdata.glamo_irq_is_wired =
glamo->pdata->glamo_irq_is_wired;
- glamo_mmc_dev.dev.parent = &pdev->dev;
- /* we need it later to give to the engine enable and disable */
- glamo_mci_def_pdata.pglamo = glamo;
- mangle_mem_resources(glamo_mmc_dev.resource,
- glamo_mmc_dev.num_resources, glamo->mem);
- platform_device_register(&glamo_mmc_dev);
-
glamo_2d_dev.dev.parent = &pdev->dev;
mangle_mem_resources(glamo_2d_dev.resource,
glamo_2d_dev.num_resources, glamo->mem);
@@ -1065,6 +1060,13 @@ static int __init glamo_probe(struct platform_device *pdev)
glamo_spigpio_dev.dev.platform_data = glamo->pdata->spigpio_info;
platform_device_register(&glamo_spigpio_dev);
+ glamo_mmc_dev.dev.parent = &pdev->dev;
+ /* we need it later to give to the engine enable and disable */
+ glamo_mci_def_pdata.pglamo = glamo;
+ mangle_mem_resources(glamo_mmc_dev.resource,
+ glamo_mmc_dev.num_resources, glamo->mem);
+ platform_device_register(&glamo_mmc_dev);
+
/* only request the generic, hostbus and memory controller MMIO */
glamo->mem = request_mem_region(glamo->mem->start,
GLAMO_REGOFS_VIDCAP, "glamo-core");
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
index bbbbe4dab97..d8847c5ddca 100644
--- a/drivers/mfd/glamo/glamo-mci.c
+++ b/drivers/mfd/glamo/glamo-mci.c
@@ -405,11 +405,11 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
u16 * reg_resp = (u16 *)(host->base + GLAMO_REG_MMC_CMD_RSP1);
u16 status;
int n;
+ int timeout = 100000000;
if (host->suspending) {
- cmd->error = -EIO;
- if (cmd->data)
- cmd->data->error = -EIO;
+ dev_err(&host->pdev->dev, "faking cmd %d "
+ "during suspend\n", cmd->opcode);
mmc_request_done(mmc, mrq);
return;
}
@@ -502,10 +502,23 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
* our own INT# line"
*/
if (!glamo_mci_def_pdata.pglamo->irq_works) {
- /* we have faith we will get an "interrupt"... */
- while (!(readw_dly(glamo_mci_def_pdata.pglamo->base +
- GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC))
+ /*
+ * we have faith we will get an "interrupt"...
+ * but something insane like suspend problems can mean
+ * we spin here forever, so we timeout after a LONG time
+ */
+ while ((!(readw_dly(glamo_mci_def_pdata.pglamo->base +
+ GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC)) &&
+ (timeout--))
;
+
+ if (timeout < 0) {
+ if (cmd->data->error)
+ cmd->data->error = -ETIMEDOUT;
+ dev_err(&host->pdev->dev, "Payload timeout\n");
+ return;
+ }
+
/* yay we are an interrupt controller! -- call the ISR */
glamo_mci_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC),
irq_desc + IRQ_GLAMO(GLAMO_IRQIDX_MMC));
@@ -529,6 +542,7 @@ static void glamo_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
static void glamo_mci_reset(struct glamo_mci_host *host)
{
+ dev_dbg(&host->pdev->dev, "******* glamo_mci_reset\n");
/* reset MMC controller */
writew_dly(GLAMO_CLOCK_MMC_RESET | GLAMO_CLOCK_MMC_DG_TCLK |
GLAMO_CLOCK_MMC_EN_TCLK | GLAMO_CLOCK_MMC_DG_M9CLK |
@@ -803,8 +817,7 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
struct glamo_mci_host *host = mmc_priv(mmc);
host->suspending++;
-
- return mmc_suspend_host(mmc, state);
+ return mmc_suspend_host(mmc, state);
}
static int glamo_mci_resume(struct platform_device *dev)