Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pata_sl82c105: add Power Management support

Fixes IDE -> libata regression.

There shouldn't be any problems with it as corresponding IDE's host
driver (sl82c105) has been supporting PCI Power Management since
Oct 10 2008 (commit feb22b7f "ide: add proper PCI PM support (v2)")
and IDE PM since Jun 14 2003 (patch v2.5.73 "ide: Power Management").

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Bartlomiej Zolnierkiewicz and committed by
Jeff Garzik
81452182 adacaf14

+32 -5
+32 -5
drivers/ata/pata_sl82c105.c
··· 1 1 /* 2 2 * pata_sl82c105.c - SL82C105 PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 + * (C) 2011 Bartlomiej Zolnierkiewicz 4 5 * 5 6 * Based in part on linux/drivers/ide/pci/sl82c105.c 6 7 * SL82C105/Winbond 553 IDE driver ··· 290 289 return bridge->revision; 291 290 } 292 291 292 + static void sl82c105_fixup(struct pci_dev *pdev) 293 + { 294 + u32 val; 295 + 296 + pci_read_config_dword(pdev, 0x40, &val); 297 + val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 298 + pci_write_config_dword(pdev, 0x40, val); 299 + } 293 300 294 301 static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) 295 302 { ··· 315 306 /* for now use only the first port */ 316 307 const struct ata_port_info *ppi[] = { &info_early, 317 308 NULL }; 318 - u32 val; 319 309 int rev; 320 310 int rc; 321 311 ··· 333 325 else 334 326 ppi[0] = &info_dma; 335 327 336 - pci_read_config_dword(dev, 0x40, &val); 337 - val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 338 - pci_write_config_dword(dev, 0x40, val); 328 + sl82c105_fixup(dev); 339 329 340 330 return ata_pci_bmdma_init_one(dev, ppi, &sl82c105_sht, NULL, 0); 341 331 } 332 + 333 + #ifdef CONFIG_PM 334 + static int sl82c105_reinit_one(struct pci_dev *pdev) 335 + { 336 + struct ata_host *host = dev_get_drvdata(&pdev->dev); 337 + int rc; 338 + 339 + rc = ata_pci_device_do_resume(pdev); 340 + if (rc) 341 + return rc; 342 + 343 + sl82c105_fixup(pdev); 344 + 345 + ata_host_resume(host); 346 + return 0; 347 + } 348 + #endif 342 349 343 350 static const struct pci_device_id sl82c105[] = { 344 351 { PCI_VDEVICE(WINBOND, PCI_DEVICE_ID_WINBOND_82C105), }, ··· 365 342 .name = DRV_NAME, 366 343 .id_table = sl82c105, 367 344 .probe = sl82c105_init_one, 368 - .remove = ata_pci_remove_one 345 + .remove = ata_pci_remove_one, 346 + #ifdef CONFIG_PM 347 + .suspend = ata_pci_device_suspend, 348 + .resume = sl82c105_reinit_one, 349 + #endif 369 350 }; 370 351 371 352 static int __init sl82c105_init(void)