[PATCH] sata_sil24: add suspend/sleep support

Add suspend/sleep support.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Tejun Heo and committed by Jeff Garzik d2298dca 2a41a610

+25
+25
drivers/scsi/sata_sil24.c
··· 92 92 HOST_CTRL_STOP = (1 << 18), /* latched PCI STOP */ 93 93 HOST_CTRL_DEVSEL = (1 << 19), /* latched PCI DEVSEL */ 94 94 HOST_CTRL_REQ64 = (1 << 20), /* latched PCI REQ64 */ 95 + HOST_CTRL_GLOBAL_RST = (1 << 31), /* global reset */ 95 96 96 97 /* 97 98 * Port registers ··· 339 338 static void sil24_port_stop(struct ata_port *ap); 340 339 static void sil24_host_stop(struct ata_host_set *host_set); 341 340 static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 341 + static int sil24_pci_device_resume(struct pci_dev *pdev); 342 342 343 343 static const struct pci_device_id sil24_pci_tbl[] = { 344 344 { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, ··· 355 353 .id_table = sil24_pci_tbl, 356 354 .probe = sil24_init_one, 357 355 .remove = ata_pci_remove_one, /* safe? */ 356 + .suspend = ata_pci_device_suspend, 357 + .resume = sil24_pci_device_resume, 358 358 }; 359 359 360 360 static struct scsi_host_template sil24_sht = { ··· 376 372 .slave_configure = ata_scsi_slave_config, 377 373 .slave_destroy = ata_scsi_slave_destroy, 378 374 .bios_param = ata_std_bios_param, 375 + .suspend = ata_scsi_device_suspend, 376 + .resume = ata_scsi_device_resume, 379 377 }; 380 378 381 379 static const struct ata_port_operations sil24_ops = { ··· 1183 1177 out_disable: 1184 1178 pci_disable_device(pdev); 1185 1179 return rc; 1180 + } 1181 + 1182 + static int sil24_pci_device_resume(struct pci_dev *pdev) 1183 + { 1184 + struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1185 + struct sil24_host_priv *hpriv = host_set->private_data; 1186 + 1187 + ata_pci_device_do_resume(pdev); 1188 + 1189 + if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) 1190 + writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL); 1191 + 1192 + sil24_init_controller(pdev, host_set->n_ports, 1193 + host_set->ports[0]->flags, 1194 + hpriv->host_base, hpriv->port_base); 1195 + 1196 + ata_host_set_resume(host_set); 1197 + 1198 + return 0; 1186 1199 } 1187 1200 1188 1201 static int __init sil24_init(void)