diff options
| author | Dave Liu <daveliu@freescale.com> | 2009-06-10 23:53:37 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@redhat.com> | 2009-06-23 01:54:27 -0400 |
| commit | dc77ad4c8727d3a1c23eadcb287501dab480d634 (patch) | |
| tree | 6fee52f064bca281a80612d9627a96bed3ba61d8 | |
| parent | 918d7b7c330f8afe18cb1b8692fc5f45a798634e (diff) | |
sata_fsl: Add power mgmt support
Signed-off-by: Dave Liu <daveliu@freescale.com>
Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
| -rw-r--r-- | drivers/ata/sata_fsl.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 36b8629203be..94eaa432c40a 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
| @@ -1378,6 +1378,37 @@ static int sata_fsl_remove(struct of_device *ofdev) | |||
| 1378 | return 0; | 1378 | return 0; |
| 1379 | } | 1379 | } |
| 1380 | 1380 | ||
| 1381 | #ifdef CONFIG_PM | ||
| 1382 | static int sata_fsl_suspend(struct of_device *op, pm_message_t state) | ||
| 1383 | { | ||
| 1384 | struct ata_host *host = dev_get_drvdata(&op->dev); | ||
| 1385 | return ata_host_suspend(host, state); | ||
| 1386 | } | ||
| 1387 | |||
| 1388 | static int sata_fsl_resume(struct of_device *op) | ||
| 1389 | { | ||
| 1390 | struct ata_host *host = dev_get_drvdata(&op->dev); | ||
| 1391 | struct sata_fsl_host_priv *host_priv = host->private_data; | ||
| 1392 | int ret; | ||
| 1393 | void __iomem *hcr_base = host_priv->hcr_base; | ||
| 1394 | struct ata_port *ap = host->ports[0]; | ||
| 1395 | struct sata_fsl_port_priv *pp = ap->private_data; | ||
| 1396 | |||
| 1397 | ret = sata_fsl_init_controller(host); | ||
| 1398 | if (ret) { | ||
| 1399 | dev_printk(KERN_ERR, &op->dev, | ||
| 1400 | "Error initialize hardware\n"); | ||
| 1401 | return ret; | ||
| 1402 | } | ||
| 1403 | |||
| 1404 | /* Recovery the CHBA register in host controller cmd register set */ | ||
| 1405 | iowrite32(pp->cmdslot_paddr & 0xffffffff, hcr_base + CHBA); | ||
| 1406 | |||
| 1407 | ata_host_resume(host); | ||
| 1408 | return 0; | ||
| 1409 | } | ||
| 1410 | #endif | ||
| 1411 | |||
| 1381 | static struct of_device_id fsl_sata_match[] = { | 1412 | static struct of_device_id fsl_sata_match[] = { |
| 1382 | { | 1413 | { |
| 1383 | .compatible = "fsl,pq-sata", | 1414 | .compatible = "fsl,pq-sata", |
| @@ -1392,6 +1423,10 @@ static struct of_platform_driver fsl_sata_driver = { | |||
| 1392 | .match_table = fsl_sata_match, | 1423 | .match_table = fsl_sata_match, |
| 1393 | .probe = sata_fsl_probe, | 1424 | .probe = sata_fsl_probe, |
| 1394 | .remove = sata_fsl_remove, | 1425 | .remove = sata_fsl_remove, |
| 1426 | #ifdef CONFIG_PM | ||
| 1427 | .suspend = sata_fsl_suspend, | ||
| 1428 | .resume = sata_fsl_resume, | ||
| 1429 | #endif | ||
| 1395 | }; | 1430 | }; |
| 1396 | 1431 | ||
| 1397 | static int __init sata_fsl_init(void) | 1432 | static int __init sata_fsl_init(void) |
