summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhu <r65037@freescale.com>2008-03-21 14:39:00 +0800
committerDaniel Schaeffer <daniel.schaeffer@timesys.com>2008-08-25 15:20:53 -0400
commit3bfa05d80bfb634e944c3be1ba102838fa37eab5 (patch)
treef5114fe1b889d34d7b053d09bb70a47b17914a92
parented769fd8835602f316ca7364ec0e1ea189feace5 (diff)
ENGR00069375 ATA disk drive can't be powered up correctly
The GPO1 should be enabled by PM system, not by the ATA driver distinctly. Refine the remove function about the regulator usage. Signed-off-by: Richard Zhu <r65037@freescale.com>
-rw-r--r--drivers/ide/arm/mxc_ide.c37
-rw-r--r--drivers/ide/arm/mxc_ide.h2
2 files changed, 18 insertions, 21 deletions
diff --git a/drivers/ide/arm/mxc_ide.c b/drivers/ide/arm/mxc_ide.c
index 044b95832f80..cfc930a90d67 100644
--- a/drivers/ide/arm/mxc_ide.c
+++ b/drivers/ide/arm/mxc_ide.c
@@ -37,6 +37,7 @@
#include <linux/init.h>
#include <linux/ide.h>
#include <linux/clk.h>
+#include <linux/delay.h>
#include <asm/mach-types.h>
@@ -1115,8 +1116,6 @@ static int mxc_ide_probe(struct platform_device *pdev)
goto ERR_NODEV;
}
- /* Enable the hdd disk power supply */
-
ATA_RAW_WRITE(MXC_IDE_CTRL_ATA_RST_B, MXC_IDE_ATA_CONTROL);
/* Select group B pins, and enable the interface */
@@ -1136,6 +1135,7 @@ static int mxc_ide_probe(struct platform_device *pdev)
printk(KERN_INFO "enable regulator error.\n");
goto ERR_NODEV;
}
+ msleep(100);
}
} else
regulator_drive = NULL;
@@ -1150,6 +1150,7 @@ static int mxc_ide_probe(struct platform_device *pdev)
printk(KERN_INFO "enable regulator error.\n");
goto ERR_NODEV;
}
+ msleep(100);
}
} else
regulator_io = NULL;
@@ -1177,11 +1178,11 @@ static int mxc_ide_probe(struct platform_device *pdev)
ATA_RAW_WRITE(0, MXC_IDE_INTR_ENABLE);
if (regulator_drive) {
regulator_disable(regulator_drive);
- regulator_put(regulator_drive, priv->dev);
+ regulator_put(regulator_drive, &pdev->dev);
}
if (regulator_io) {
regulator_disable(regulator_io);
- regulator_put(regulator_io, priv->dev);
+ regulator_put(regulator_io, &pdev->dev);
}
gpio_ata_inactive();
goto ERR_NOMEM;
@@ -1209,14 +1210,15 @@ static int mxc_ide_probe(struct platform_device *pdev)
*/
/* Poweroff the HDD */
clk_disable(ata_clk);
+ clk_put(ata_clk);
priv->attached = 0;
if (regulator_drive) {
regulator_disable(regulator_drive);
- regulator_put(regulator_drive, priv->dev);
+ regulator_put(regulator_drive, &pdev->dev);
}
if (regulator_io) {
regulator_disable(regulator_io);
- regulator_put(regulator_io, priv->dev);
+ regulator_put(regulator_io, &pdev->dev);
}
gpio_ata_inactive();
kfree(priv);
@@ -1229,8 +1231,8 @@ static int mxc_ide_probe(struct platform_device *pdev)
ATA_RAW_WRITE(MXC_IDE_CTRL_ATA_RST_B | MXC_IDE_CTRL_IORDY_EN,
MXC_IDE_ATA_CONTROL);
#endif
- ide_plat->power_drive = (char *)regulator_drive;
- ide_plat->power_io = (char *)regulator_io;
+ priv->regulator_drive = regulator_drive;
+ priv->regulator_io = regulator_io;
return 0;
ERR_NODEV:
@@ -1250,7 +1252,6 @@ ERR_NOMEM:
*/
static int mxc_ide_remove(struct platform_device *pdev)
{
- struct mxc_ide_platform_data *ide_plat = pdev->dev.platform_data;
ide_hwif_t *hwif = ifs[0];
mxc_ide_private_t *priv;
@@ -1291,19 +1292,13 @@ static int mxc_ide_remove(struct platform_device *pdev)
/* Disable power supply */
if (priv->attached) {
priv->attached = 0;
- if (ide_plat->power_drive) {
- regulator_disable((struct regulator *)ide_plat->
- power_drive);
- regulator_put((struct regulator *)ide_plat->power_drive,
- priv->dev);
- ide_plat->power_drive = NULL;
+ if (priv->regulator_drive) {
+ regulator_disable(priv->regulator_drive);
+ regulator_put((priv->regulator_drive), &pdev->dev);
}
- if (ide_plat->power_io) {
- regulator_disable((struct regulator *)ide_plat->
- power_io);
- regulator_put((struct regulator *)ide_plat->power_io,
- priv->dev);
- ide_plat->power_io = NULL;
+ if (priv->regulator_io) {
+ regulator_disable(priv->regulator_io);
+ regulator_put((priv->regulator_io), &pdev->dev);
}
}
diff --git a/drivers/ide/arm/mxc_ide.h b/drivers/ide/arm/mxc_ide.h
index 8534e8e2663f..bc786e99921f 100644
--- a/drivers/ide/arm/mxc_ide.h
+++ b/drivers/ide/arm/mxc_ide.h
@@ -114,6 +114,8 @@ typedef struct {
int dma_stat; /*!< the state of DMA request */
u8 enable; /*!< Current hardware interrupt mask */
u8 attached; /*!< device attached or not */
+ struct regulator *regulator_drive;
+ struct regulator *regulator_io;
} mxc_ide_private_t;
/*! ATA transfer mode for set_ata_bus_timing() */