summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Fan <r01011@freescale.com>2008-04-26 16:24:22 +0800
committerDaniel Schaeffer <daniel.schaeffer@timesys.com>2008-08-25 15:21:04 -0400
commitc5941844f91ca8ef8984ce5db51ebac72cfd95c8 (patch)
tree2dcbff3950d607cbc5f402345a7436d0c6c7cd05
parent5c672d5af533e0da596177e3716f60266e2991a9 (diff)
ENGR00074462 Fix system can not leave suspend mode when HD is valid
Fix the wrong code about operating regulators. And set capibility about pio mode. Signed-off-by: Fred Fan <r01011@freescale.com> (cherry picked from commit 9a0ad3d5c9080d7f48eb8d06860258d086d93933)
-rw-r--r--drivers/ide/arm/mxc_ide.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/drivers/ide/arm/mxc_ide.c b/drivers/ide/arm/mxc_ide.c
index cfc930a90d67..f8997b67d808 100644
--- a/drivers/ide/arm/mxc_ide.c
+++ b/drivers/ide/arm/mxc_ide.c
@@ -340,7 +340,7 @@ static void mxc_ide_dma_off_quietly(ide_drive_t * drive)
*/
static void mxc_ide_resetproc(ide_drive_t * drive)
{
- printk(KERN_INFO "%s: resetting ATA controller\n", __func__);
+ pr_info("%s: resetting ATA controller\n", __func__);
ATA_RAW_WRITE(0x00, MXC_IDE_ATA_CONTROL);
udelay(100);
@@ -369,7 +369,7 @@ static int mxc_ide_dma_on(ide_drive_t * drive)
* ground leads between all the signals)
*/
rc = mxc_ide_config_drive(drive, XFER_UDMA_3);
- printk(KERN_INFO "%s: enabling UDMA3 mode %s\n", drive->name,
+ pr_info("%s: enabling UDMA3 mode %s\n", drive->name,
rc == 0 ? "success" : "failed");
drive->using_dma = 1;
@@ -874,7 +874,7 @@ static void mxc_ide_dma_init(ide_hwif_t * hwif)
goto err_out;
}
- printk(KERN_INFO "%s: read chan=%d , write chan=%d \n",
+ pr_info("%s: read chan=%d , write chan=%d \n",
hwif->name, priv->dma_read_chan, priv->dma_write_chan);
set_ata_bus_timing(0, UDMA);
@@ -954,6 +954,7 @@ mxc_ide_register(unsigned long base, unsigned int aux, int irq,
hwif->selectproc = &mxc_ide_selectproc;
hwif->maskproc = &mxc_ide_maskproc;
hwif->hwif_data = (void *)priv;
+ hwif->pio_mask = ATA_PIO4;
mxc_ide_set_intrq(hwif, INTRQ_MCU);
/*
@@ -961,8 +962,7 @@ mxc_ide_register(unsigned long base, unsigned int aux, int irq,
* if we don't, discard the interface reset the ports.
*/
if (!hwif->present) {
- printk(KERN_INFO "ide%d: Bus empty, interface released.\n",
- hwif->index);
+ pr_info("ide%d: Bus empty, interface released.\n", hwif->index);
for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i)
hwif->io_ports[i] = 0;
hwif->chipset = ide_unknown;
@@ -992,7 +992,6 @@ mxc_ide_register(unsigned long base, unsigned int aux, int irq,
*/
static int mxc_ide_suspend(struct platform_device *pdev, pm_message_t state)
{
- struct mxc_ide_platform_data *ide_plat = pdev->dev.platform_data;
ide_hwif_t *hwif = &ide_hwifs[0];
mxc_ide_private_t *priv = (mxc_ide_private_t *) (hwif->hwif_data);
@@ -1018,13 +1017,10 @@ static int mxc_ide_suspend(struct platform_device *pdev, pm_message_t state)
/* There is a HDD disk attached on the ata bus */
if (priv->attached == 1) {
/* power off the ATA pwr supply */
- if (ide_plat->power_drive)
- regulator_disable((struct regulator *)ide_plat->
- power_drive);
- if (ide_plat->power_io) {
- regulator_disable((struct regulator *)ide_plat->
- power_io);
- }
+ if (priv->regulator_drive)
+ regulator_disable(priv->regulator_drive);
+ if (priv->regulator_io)
+ regulator_disable(priv->regulator_io);
gpio_ata_inactive();
}
@@ -1033,7 +1029,6 @@ static int mxc_ide_suspend(struct platform_device *pdev, pm_message_t state)
static int mxc_ide_resume(struct platform_device *pdev)
{
- struct mxc_ide_platform_data *ide_plat = pdev->dev.platform_data;
ide_hwif_t *hwif = &ide_hwifs[0];
mxc_ide_private_t *priv = (mxc_ide_private_t *) (hwif->hwif_data);
@@ -1042,15 +1037,13 @@ static int mxc_ide_resume(struct platform_device *pdev)
/* Select group B pins, and enable the interface */
gpio_ata_active();
/* power up the ATA pwr supply */
- if (ide_plat->power_drive) {
- if (regulator_enable
- ((struct regulator *)ide_plat->power_drive))
- printk(KERN_INFO "enable power_drive error.\n");
+ if (priv->regulator_drive) {
+ if (regulator_enable(priv->regulator_drive))
+ printk(KERN_ERR "enable power_drive error.\n");
}
- if (ide_plat->power_io) {
- if (regulator_enable
- ((struct regulator *)ide_plat->power_io))
- printk(KERN_INFO "enable power_io error.\n");
+ if (priv->regulator_io) {
+ if (regulator_enable(priv->regulator_io))
+ printk(KERN_ERR "enable power_io error.\n");
}
/* Deassert the reset bit to enable the interface */
@@ -1099,8 +1092,7 @@ static int mxc_ide_probe(struct platform_device *pdev)
struct mxc_ide_platform_data *ide_plat = pdev->dev.platform_data;
struct regulator *regulator_drive, *regulator_io;
- printk(KERN_INFO
- "MXC: IDE driver, (c) 2004-2008 Freescale Semiconductor\n");
+ pr_info("MXC: IDE driver, (c) 2004-2008 Freescale Semiconductor\n");
if (!ide_plat)
return -EINVAL;
@@ -1108,11 +1100,11 @@ static int mxc_ide_probe(struct platform_device *pdev)
ata_clk = clk_get(NULL, "ata_clk");
if (ata_clk) {
if (clk_enable(ata_clk)) {
- printk(KERN_INFO "enable clk error.\n");
+ printk(KERN_ERR "enable clk error.\n");
goto ERR_NODEV;
}
} else {
- printk(KERN_INFO "MXC: IDE driver, can't get clk\n");
+ printk(KERN_ERR "MXC: IDE driver, can't get clk\n");
goto ERR_NODEV;
}
@@ -1128,11 +1120,11 @@ static int mxc_ide_probe(struct platform_device *pdev)
regulator_drive = regulator_get(&pdev->dev,
ide_plat->power_drive);
if (IS_ERR(regulator_drive)) {
- printk(KERN_INFO "MXC: IDE driver, can't get power\n");
+ printk(KERN_ERR "MXC: IDE driver, can't get power\n");
goto ERR_NODEV;
} else {
if (regulator_enable(regulator_drive)) {
- printk(KERN_INFO "enable regulator error.\n");
+ printk(KERN_ERR "enable regulator error.\n");
goto ERR_NODEV;
}
msleep(100);
@@ -1143,11 +1135,11 @@ static int mxc_ide_probe(struct platform_device *pdev)
if (ide_plat->power_io != NULL) {
regulator_io = regulator_get(&pdev->dev, ide_plat->power_io);
if (IS_ERR(regulator_io)) {
- printk(KERN_INFO "MXC: IDE driver, can't get power\n");
+ printk(KERN_ERR "MXC: IDE driver, can't get power\n");
goto ERR_NODEV;
} else {
if (regulator_enable(regulator_io)) {
- printk(KERN_INFO "enable regulator error.\n");
+ printk(KERN_ERR "enable regulator error.\n");
goto ERR_NODEV;
}
msleep(100);
@@ -1235,9 +1227,9 @@ static int mxc_ide_probe(struct platform_device *pdev)
priv->regulator_io = regulator_io;
return 0;
-ERR_NODEV:
+ ERR_NODEV:
return -ENODEV;
-ERR_NOMEM:
+ ERR_NOMEM:
return -ENOMEM;
}