Skip to content

Commit d6ecf15

Browse files
tpetazzonihtejun
authored andcommitted
ata: ahci_mvebu: add suspend/resume support
This commit adds suspend/resume support to the ahci_mvebu driver. The suspend hook doesn't do anything special despite calling the generic ahci_platform_suspend_host() function. However, the resume hook has to restore the MBus windows configuration, as well as the regret option. Tested on Marvell Armada 388 GP. Signed-off-by: Thomas Petazzoni <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 34c5693 commit d6ecf15

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/ata/ahci_mvebu.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)
6262
writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
6363
}
6464

65+
static int ahci_mvebu_suspend(struct platform_device *pdev, pm_message_t state)
66+
{
67+
return ahci_platform_suspend_host(&pdev->dev);
68+
}
69+
70+
static int ahci_mvebu_resume(struct platform_device *pdev)
71+
{
72+
struct ata_host *host = platform_get_drvdata(pdev);
73+
struct ahci_host_priv *hpriv = host->private_data;
74+
const struct mbus_dram_target_info *dram;
75+
76+
dram = mv_mbus_dram_info();
77+
if (dram)
78+
ahci_mvebu_mbus_config(hpriv, dram);
79+
80+
ahci_mvebu_regret_option(hpriv);
81+
82+
return ahci_platform_resume_host(&pdev->dev);
83+
}
84+
6585
static const struct ata_port_info ahci_mvebu_port_info = {
6686
.flags = AHCI_FLAG_COMMON,
6787
.pio_mask = ATA_PIO4,
@@ -120,6 +140,8 @@ MODULE_DEVICE_TABLE(of, ahci_mvebu_of_match);
120140
static struct platform_driver ahci_mvebu_driver = {
121141
.probe = ahci_mvebu_probe,
122142
.remove = ata_platform_remove_one,
143+
.suspend = ahci_mvebu_suspend,
144+
.resume = ahci_mvebu_resume,
123145
.driver = {
124146
.name = DRV_NAME,
125147
.of_match_table = ahci_mvebu_of_match,

0 commit comments

Comments
 (0)