ide: add proper PCI PM support (v2)

* Keep pointer to ->init_chipset method also in
  struct ide_host and set it in ide_host_alloc_all().

* Add ide_pci_suspend() and ide_pci_resume() helpers
  (default ->suspend and ->resume implementations).

* ->init_chipset can no longer be marked __devinit.

* Add proper PCI PM support to IDE PCI host drivers
  (rz1000.c and tc86c001.c are skipped for now since
  they need to be converted from using ->init_hwif
  to use ->init_chipset instead).

v2:
* Cleanup CONFIG_PM #ifdef-s per akpm's suggestion.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 1785192b
...@@ -1586,8 +1586,10 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d, ...@@ -1586,8 +1586,10 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
if (hws[0]) if (hws[0])
host->dev[0] = hws[0]->dev; host->dev[0] = hws[0]->dev;
if (d) if (d) {
host->init_chipset = d->init_chipset;
host->host_flags = d->host_flags; host->host_flags = d->host_flags;
}
return host; return host;
} }
......
...@@ -139,7 +139,7 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -139,7 +139,7 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0); drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0);
} }
static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev) static unsigned int init_chipset_aec62xx(struct pci_dev *dev)
{ {
/* These are necessary to get AEC6280 Macintosh cards to work */ /* These are necessary to get AEC6280 Macintosh cards to work */
if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) ||
...@@ -307,6 +307,8 @@ static struct pci_driver driver = { ...@@ -307,6 +307,8 @@ static struct pci_driver driver = {
.id_table = aec62xx_pci_tbl, .id_table = aec62xx_pci_tbl,
.probe = aec62xx_init_one, .probe = aec62xx_init_one,
.remove = __devexit_p(aec62xx_remove), .remove = __devexit_p(aec62xx_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init aec62xx_ide_init(void) static int __init aec62xx_ide_init(void)
......
...@@ -213,7 +213,7 @@ static int ali15x3_dma_setup(ide_drive_t *drive) ...@@ -213,7 +213,7 @@ static int ali15x3_dma_setup(ide_drive_t *drive)
* appropriate also sets up the 1533 southbridge. * appropriate also sets up the 1533 southbridge.
*/ */
static unsigned int __devinit init_chipset_ali15x3(struct pci_dev *dev) static unsigned int init_chipset_ali15x3(struct pci_dev *dev)
{ {
unsigned long flags; unsigned long flags;
u8 tmpbyte; u8 tmpbyte;
...@@ -581,6 +581,8 @@ static struct pci_driver driver = { ...@@ -581,6 +581,8 @@ static struct pci_driver driver = {
.id_table = alim15x3_pci_tbl, .id_table = alim15x3_pci_tbl,
.probe = alim15x3_init_one, .probe = alim15x3_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init ali15x3_ide_init(void) static int __init ali15x3_ide_init(void)
......
...@@ -112,13 +112,13 @@ static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -112,13 +112,13 @@ static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
amd_set_drive(drive, XFER_PIO_0 + pio); amd_set_drive(drive, XFER_PIO_0 + pio);
} }
static void __devinit amd7409_cable_detect(struct pci_dev *dev) static void amd7409_cable_detect(struct pci_dev *dev)
{ {
/* no host side cable detection */ /* no host side cable detection */
amd_80w = 0x03; amd_80w = 0x03;
} }
static void __devinit amd7411_cable_detect(struct pci_dev *dev) static void amd7411_cable_detect(struct pci_dev *dev)
{ {
int i; int i;
u32 u = 0; u32 u = 0;
...@@ -140,7 +140,7 @@ static void __devinit amd7411_cable_detect(struct pci_dev *dev) ...@@ -140,7 +140,7 @@ static void __devinit amd7411_cable_detect(struct pci_dev *dev)
* The initialization callback. Initialize drive independent registers. * The initialization callback. Initialize drive independent registers.
*/ */
static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev) static unsigned int init_chipset_amd74xx(struct pci_dev *dev)
{ {
u8 t = 0, offset = amd_offset(dev); u8 t = 0, offset = amd_offset(dev);
...@@ -324,6 +324,8 @@ static struct pci_driver driver = { ...@@ -324,6 +324,8 @@ static struct pci_driver driver = {
.id_table = amd74xx_pci_tbl, .id_table = amd74xx_pci_tbl,
.probe = amd74xx_probe, .probe = amd74xx_probe,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init amd74xx_ide_init(void) static int __init amd74xx_ide_init(void)
......
...@@ -187,6 +187,8 @@ static struct pci_driver driver = { ...@@ -187,6 +187,8 @@ static struct pci_driver driver = {
.id_table = atiixp_pci_tbl, .id_table = atiixp_pci_tbl,
.probe = atiixp_init_one, .probe = atiixp_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init atiixp_ide_init(void) static int __init atiixp_ide_init(void)
......
...@@ -331,7 +331,7 @@ static int cmd646_1_dma_end(ide_drive_t *drive) ...@@ -331,7 +331,7 @@ static int cmd646_1_dma_end(ide_drive_t *drive)
return (dma_stat & 7) != 4; return (dma_stat & 7) != 4;
} }
static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev) static unsigned int init_chipset_cmd64x(struct pci_dev *dev)
{ {
u8 mrdmode = 0; u8 mrdmode = 0;
...@@ -510,6 +510,8 @@ static struct pci_driver driver = { ...@@ -510,6 +510,8 @@ static struct pci_driver driver = {
.id_table = cmd64x_pci_tbl, .id_table = cmd64x_pci_tbl,
.probe = cmd64x_init_one, .probe = cmd64x_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init cmd64x_ide_init(void) static int __init cmd64x_ide_init(void)
......
...@@ -149,6 +149,8 @@ static struct pci_driver driver = { ...@@ -149,6 +149,8 @@ static struct pci_driver driver = {
.name = "Cyrix_IDE", .name = "Cyrix_IDE",
.id_table = cs5520_pci_tbl, .id_table = cs5520_pci_tbl,
.probe = cs5520_init_one, .probe = cs5520_init_one,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init cs5520_ide_init(void) static int __init cs5520_ide_init(void)
......
...@@ -134,7 +134,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) ...@@ -134,7 +134,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
* Initialize the cs5530 bridge for reliable IDE DMA operation. * Initialize the cs5530 bridge for reliable IDE DMA operation.
*/ */
static unsigned int __devinit init_chipset_cs5530(struct pci_dev *dev) static unsigned int init_chipset_cs5530(struct pci_dev *dev)
{ {
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
...@@ -272,6 +272,8 @@ static struct pci_driver driver = { ...@@ -272,6 +272,8 @@ static struct pci_driver driver = {
.id_table = cs5530_pci_tbl, .id_table = cs5530_pci_tbl,
.probe = cs5530_init_one, .probe = cs5530_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init cs5530_ide_init(void) static int __init cs5530_ide_init(void)
......
...@@ -197,6 +197,8 @@ static struct pci_driver driver = { ...@@ -197,6 +197,8 @@ static struct pci_driver driver = {
.id_table = cs5535_pci_tbl, .id_table = cs5535_pci_tbl,
.probe = cs5535_init_one, .probe = cs5535_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init cs5535_ide_init(void) static int __init cs5535_ide_init(void)
......
...@@ -332,7 +332,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -332,7 +332,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
/* /*
* this function is called during init and is used to setup the cy82c693 chip * this function is called during init and is used to setup the cy82c693 chip
*/ */
static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev) static unsigned int init_chipset_cy82c693(struct pci_dev *dev)
{ {
if (PCI_FUNC(dev->devfn) != 1) if (PCI_FUNC(dev->devfn) != 1)
return 0; return 0;
...@@ -448,6 +448,8 @@ static struct pci_driver driver = { ...@@ -448,6 +448,8 @@ static struct pci_driver driver = {
.id_table = cy82c693_pci_tbl, .id_table = cy82c693_pci_tbl,
.probe = cy82c693_init_one, .probe = cy82c693_init_one,
.remove = __devexit_p(cy82c693_remove), .remove = __devexit_p(cy82c693_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init cy82c693_ide_init(void) static int __init cy82c693_ide_init(void)
......
...@@ -171,6 +171,8 @@ static struct pci_driver driver = { ...@@ -171,6 +171,8 @@ static struct pci_driver driver = {
.id_table = generic_pci_tbl, .id_table = generic_pci_tbl,
.probe = generic_init_one, .probe = generic_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init generic_ide_init(void) static int __init generic_ide_init(void)
......
...@@ -78,7 +78,7 @@ static void hpt34x_set_pio_mode(ide_drive_t *drive, const u8 pio) ...@@ -78,7 +78,7 @@ static void hpt34x_set_pio_mode(ide_drive_t *drive, const u8 pio)
*/ */
#define HPT34X_PCI_INIT_REG 0x80 #define HPT34X_PCI_INIT_REG 0x80
static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev) static unsigned int init_chipset_hpt34x(struct pci_dev *dev)
{ {
int i = 0; int i = 0;
unsigned long hpt34xIoBase = pci_resource_start(dev, 4); unsigned long hpt34xIoBase = pci_resource_start(dev, 4);
...@@ -171,6 +171,8 @@ static struct pci_driver driver = { ...@@ -171,6 +171,8 @@ static struct pci_driver driver = {
.id_table = hpt34x_pci_tbl, .id_table = hpt34x_pci_tbl,
.probe = hpt34x_init_one, .probe = hpt34x_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init hpt34x_ide_init(void) static int __init hpt34x_ide_init(void)
......
...@@ -943,7 +943,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq) ...@@ -943,7 +943,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq)
* Perform a calibration cycle on the DPLL. * Perform a calibration cycle on the DPLL.
* Returns 1 if this succeeds * Returns 1 if this succeeds
*/ */
static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f_high) static int hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f_high)
{ {
u32 dpll = (f_high << 16) | f_low | 0x100; u32 dpll = (f_high << 16) | f_low | 0x100;
u8 scr2; u8 scr2;
...@@ -971,7 +971,7 @@ static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f ...@@ -971,7 +971,7 @@ static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f
return 1; return 1;
} }
static void __devinit hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr) static void hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr)
{ {
struct ide_host *host = pci_get_drvdata(dev); struct ide_host *host = pci_get_drvdata(dev);
struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]); struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]);
...@@ -1001,7 +1001,7 @@ static void __devinit hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr) ...@@ -1001,7 +1001,7 @@ static void __devinit hpt3xx_disable_fast_irq(struct pci_dev *dev, u8 mcr_addr)
pci_write_config_byte(dev, mcr_addr + 1, new_mcr); pci_write_config_byte(dev, mcr_addr + 1, new_mcr);
} }
static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) static unsigned int init_chipset_hpt366(struct pci_dev *dev)
{ {
unsigned long io_base = pci_resource_start(dev, 4); unsigned long io_base = pci_resource_start(dev, 4);
struct hpt_info *info = hpt3xx_get_info(&dev->dev); struct hpt_info *info = hpt3xx_get_info(&dev->dev);
...@@ -1627,6 +1627,8 @@ static struct pci_driver driver = { ...@@ -1627,6 +1627,8 @@ static struct pci_driver driver = {
.id_table = hpt366_pci_tbl, .id_table = hpt366_pci_tbl,
.probe = hpt366_init_one, .probe = hpt366_init_one,
.remove = __devexit_p(hpt366_remove), .remove = __devexit_p(hpt366_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init hpt366_ide_init(void) static int __init hpt366_ide_init(void)
......
...@@ -194,6 +194,8 @@ static struct pci_driver driver = { ...@@ -194,6 +194,8 @@ static struct pci_driver driver = {
.id_table = it8213_pci_tbl, .id_table = it8213_pci_tbl,
.probe = it8213_init_one, .probe = it8213_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init it8213_ide_init(void) static int __init it8213_ide_init(void)
......
...@@ -586,7 +586,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) ...@@ -586,7 +586,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
hwif->mwdma_mask = ATA_MWDMA2; hwif->mwdma_mask = ATA_MWDMA2;
} }
static void __devinit it8212_disable_raid(struct pci_dev *dev) static void it8212_disable_raid(struct pci_dev *dev)
{ {
/* Reset local CPU, and set BIOS not ready */ /* Reset local CPU, and set BIOS not ready */
pci_write_config_byte(dev, 0x5E, 0x01); pci_write_config_byte(dev, 0x5E, 0x01);
...@@ -603,7 +603,7 @@ static void __devinit it8212_disable_raid(struct pci_dev *dev) ...@@ -603,7 +603,7 @@ static void __devinit it8212_disable_raid(struct pci_dev *dev)
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
} }
static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev) static unsigned int init_chipset_it821x(struct pci_dev *dev)
{ {
u8 conf; u8 conf;
static char *mode[2] = { "pass through", "smart" }; static char *mode[2] = { "pass through", "smart" };
...@@ -685,6 +685,8 @@ static struct pci_driver driver = { ...@@ -685,6 +685,8 @@ static struct pci_driver driver = {
.id_table = it821x_pci_tbl, .id_table = it821x_pci_tbl,
.probe = it821x_init_one, .probe = it821x_init_one,
.remove = __devexit_p(it821x_remove), .remove = __devexit_p(it821x_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init it821x_ide_init(void) static int __init it821x_ide_init(void)
......
...@@ -154,6 +154,8 @@ static struct pci_driver driver = { ...@@ -154,6 +154,8 @@ static struct pci_driver driver = {
.id_table = jmicron_pci_tbl, .id_table = jmicron_pci_tbl,
.probe = jmicron_init_one, .probe = jmicron_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init jmicron_ide_init(void) static int __init jmicron_ide_init(void)
......
...@@ -339,6 +339,8 @@ static struct pci_driver driver = { ...@@ -339,6 +339,8 @@ static struct pci_driver driver = {
.id_table = ns87415_pci_tbl, .id_table = ns87415_pci_tbl,
.probe = ns87415_init_one, .probe = ns87415_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init ns87415_ide_init(void) static int __init ns87415_ide_init(void)
......
...@@ -225,6 +225,8 @@ static struct pci_driver driver = { ...@@ -225,6 +225,8 @@ static struct pci_driver driver = {
.id_table = opti621_pci_tbl, .id_table = opti621_pci_tbl,
.probe = opti621_init_one, .probe = opti621_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init opti621_ide_init(void) static int __init opti621_ide_init(void)
......
...@@ -226,7 +226,7 @@ static void pdcnew_reset(ide_drive_t *drive) ...@@ -226,7 +226,7 @@ static void pdcnew_reset(ide_drive_t *drive)
* read_counter - Read the byte count registers * read_counter - Read the byte count registers
* @dma_base: for the port address * @dma_base: for the port address
*/ */
static long __devinit read_counter(u32 dma_base) static long read_counter(u32 dma_base)
{ {
u32 pri_dma_base = dma_base, sec_dma_base = dma_base + 0x08; u32 pri_dma_base = dma_base, sec_dma_base = dma_base + 0x08;
u8 cnt0, cnt1, cnt2, cnt3; u8 cnt0, cnt1, cnt2, cnt3;
...@@ -266,7 +266,7 @@ static long __devinit read_counter(u32 dma_base) ...@@ -266,7 +266,7 @@ static long __devinit read_counter(u32 dma_base)
* @dma_base: for the port address * @dma_base: for the port address
* E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock. * E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock.
*/ */
static long __devinit detect_pll_input_clock(unsigned long dma_base) static long detect_pll_input_clock(unsigned long dma_base)
{ {
struct timeval start_time, end_time; struct timeval start_time, end_time;
long start_count, end_count; long start_count, end_count;
...@@ -309,7 +309,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base) ...@@ -309,7 +309,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
} }
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
static void __devinit apple_kiwi_init(struct pci_dev *pdev) static void apple_kiwi_init(struct pci_dev *pdev)
{ {
struct device_node *np = pci_device_to_OF_node(pdev); struct device_node *np = pci_device_to_OF_node(pdev);
u8 conf; u8 conf;
...@@ -325,7 +325,7 @@ static void __devinit apple_kiwi_init(struct pci_dev *pdev) ...@@ -325,7 +325,7 @@ static void __devinit apple_kiwi_init(struct pci_dev *pdev)
} }
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev) static unsigned int init_chipset_pdcnew(struct pci_dev *dev)
{ {
const char *name = DRV_NAME; const char *name = DRV_NAME;
unsigned long dma_base = pci_resource_start(dev, 4); unsigned long dma_base = pci_resource_start(dev, 4);
...@@ -566,6 +566,8 @@ static struct pci_driver driver = { ...@@ -566,6 +566,8 @@ static struct pci_driver driver = {
.id_table = pdc202new_pci_tbl, .id_table = pdc202new_pci_tbl,
.probe = pdc202new_init_one, .probe = pdc202new_init_one,
.remove = __devexit_p(pdc202new_remove), .remove = __devexit_p(pdc202new_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init pdc202new_ide_init(void) static int __init pdc202new_ide_init(void)
......
...@@ -264,7 +264,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive) ...@@ -264,7 +264,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
ide_dma_timeout(drive); ide_dma_timeout(drive);
} }
static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev) static unsigned int init_chipset_pdc202xx(struct pci_dev *dev)
{ {
unsigned long dmabase = pci_resource_start(dev, 4); unsigned long dmabase = pci_resource_start(dev, 4);
u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0;
...@@ -431,6 +431,8 @@ static struct pci_driver driver = { ...@@ -431,6 +431,8 @@ static struct pci_driver driver = {
.id_table = pdc202xx_pci_tbl, .id_table = pdc202xx_pci_tbl,
.probe = pdc202xx_init_one, .probe = pdc202xx_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init pdc202xx_ide_init(void) static int __init pdc202xx_ide_init(void)
......
...@@ -204,7 +204,7 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -204,7 +204,7 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed)
* out to be nice and simple. * out to be nice and simple.
*/ */
static unsigned int __devinit init_chipset_ich(struct pci_dev *dev) static unsigned int init_chipset_ich(struct pci_dev *dev)
{ {
u32 extra = 0; u32 extra = 0;
...@@ -449,6 +449,8 @@ static struct pci_driver driver = { ...@@ -449,6 +449,8 @@ static struct pci_driver driver = {
.id_table = piix_pci_tbl, .id_table = piix_pci_tbl,
.probe = piix_init_one, .probe = piix_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init piix_ide_init(void) static int __init piix_ide_init(void)
......
...@@ -175,7 +175,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -175,7 +175,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_write_config_byte(dev, 0x54, ultra_enable); pci_write_config_byte(dev, 0x54, ultra_enable);
} }
static unsigned int __devinit init_chipset_svwks(struct pci_dev *dev) static unsigned int init_chipset_svwks(struct pci_dev *dev)
{ {
unsigned int reg; unsigned int reg;
u8 btr; u8 btr;
...@@ -448,6 +448,8 @@ static struct pci_driver driver = { ...@@ -448,6 +448,8 @@ static struct pci_driver driver = {
.id_table = svwks_pci_tbl, .id_table = svwks_pci_tbl,
.probe = svwks_init_one, .probe = svwks_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init svwks_ide_init(void) static int __init svwks_ide_init(void)
......
...@@ -463,7 +463,7 @@ static void sil_sata_pre_reset(ide_drive_t *drive) ...@@ -463,7 +463,7 @@ static void sil_sata_pre_reset(ide_drive_t *drive)
* to 133 MHz clocking if the system isn't already set up to do it. * to 133 MHz clocking if the system isn't already set up to do it.
*/ */
static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev) static unsigned int init_chipset_siimage(struct pci_dev *dev)
{ {
struct ide_host *host = pci_get_drvdata(dev); struct ide_host *host = pci_get_drvdata(dev);
void __iomem *ioaddr = host->host_priv; void __iomem *ioaddr = host->host_priv;
...@@ -834,6 +834,8 @@ static struct pci_driver driver = { ...@@ -834,6 +834,8 @@ static struct pci_driver driver = {
.id_table = siimage_pci_tbl, .id_table = siimage_pci_tbl,
.probe = siimage_init_one, .probe = siimage_init_one,
.remove = __devexit_p(siimage_remove), .remove = __devexit_p(siimage_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init siimage_ide_init(void) static int __init siimage_ide_init(void)
......
...@@ -447,7 +447,7 @@ static int __devinit sis_find_family(struct pci_dev *dev) ...@@ -447,7 +447,7 @@ static int __devinit sis_find_family(struct pci_dev *dev)
return chipset_family; return chipset_family;
} }
static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev) static unsigned int init_chipset_sis5513(struct pci_dev *dev)
{ {
/* Make general config ops here /* Make general config ops here
1/ tell IDE channels to operate in Compatibility mode only 1/ tell IDE channels to operate in Compatibility mode only
...@@ -610,6 +610,8 @@ static struct pci_driver driver = { ...@@ -610,6 +610,8 @@ static struct pci_driver driver = {
.id_table = sis5513_pci_tbl, .id_table = sis5513_pci_tbl,
.probe = sis5513_init_one, .probe = sis5513_init_one,
.remove = __devexit_p(sis5513_remove), .remove = __devexit_p(sis5513_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init sis5513_ide_init(void) static int __init sis5513_ide_init(void)
......
...@@ -271,7 +271,7 @@ static u8 sl82c105_bridge_revision(struct pci_dev *dev) ...@@ -271,7 +271,7 @@ static u8 sl82c105_bridge_revision(struct pci_dev *dev)
* channel 0 here at least, but channel 1 has to be enabled by * channel 0 here at least, but channel 1 has to be enabled by
* firmware or arch code. We still set both to 16 bits mode. * firmware or arch code. We still set both to 16 bits mode.
*/ */
static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev) static unsigned int init_chipset_sl82c105(struct pci_dev *dev)
{ {
u32 val; u32 val;
...@@ -350,6 +350,8 @@ static struct pci_driver driver = { ...@@ -350,6 +350,8 @@ static struct pci_driver driver = {
.id_table = sl82c105_pci_tbl, .id_table = sl82c105_pci_tbl,
.probe = sl82c105_init_one, .probe = sl82c105_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init sl82c105_ide_init(void) static int __init sl82c105_ide_init(void)
......
...@@ -159,6 +159,8 @@ static struct pci_driver driver = { ...@@ -159,6 +159,8 @@ static struct pci_driver driver = {
.id_table = slc90e66_pci_tbl, .id_table = slc90e66_pci_tbl,
.probe = slc90e66_init_one, .probe = slc90e66_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init slc90e66_ide_init(void) static int __init slc90e66_ide_init(void)
......
...@@ -119,6 +119,8 @@ static struct pci_driver driver = { ...@@ -119,6 +119,8 @@ static struct pci_driver driver = {
.id_table = triflex_pci_tbl, .id_table = triflex_pci_tbl,
.probe = triflex_init_one, .probe = triflex_init_one,
.remove = ide_pci_remove, .remove = ide_pci_remove,
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init triflex_ide_init(void) static int __init triflex_ide_init(void)
......
...@@ -215,7 +215,7 @@ static struct via_isa_bridge *via_config_find(struct pci_dev **isa) ...@@ -215,7 +215,7 @@ static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
/* /*
* Check and handle 80-wire cable presence * Check and handle 80-wire cable presence
*/ */
static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u) static void via_cable_detect(struct via82cxxx_dev *vdev, u32 u)
{ {
int i; int i;
...@@ -267,7 +267,7 @@ static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u) ...@@ -267,7 +267,7 @@ static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u)
* and initialize its drive independent registers. * and initialize its drive independent registers.
*/ */
static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev) static unsigned int init_chipset_via82cxxx(struct pci_dev *dev)
{ {
struct ide_host *host = pci_get_drvdata(dev); struct ide_host *host = pci_get_drvdata(dev);
struct via82cxxx_dev *vdev = host->host_priv; struct via82cxxx_dev *vdev = host->host_priv;
...@@ -492,6 +492,8 @@ static struct pci_driver driver = { ...@@ -492,6 +492,8 @@ static struct pci_driver driver = {
.id_table = via_pci_tbl, .id_table = via_pci_tbl,
.probe = via_init_one, .probe = via_init_one,
.remove = __devexit_p(via_remove), .remove = __devexit_p(via_remove),
.suspend = ide_pci_suspend,
.resume = ide_pci_resume,
}; };
static int __init via_ide_init(void) static int __init via_ide_init(void)
......
...@@ -659,3 +659,36 @@ void ide_pci_remove(struct pci_dev *dev) ...@@ -659,3 +659,36 @@ void ide_pci_remove(struct pci_dev *dev)
pci_disable_device(dev); pci_disable_device(dev);
} }
EXPORT_SYMBOL_GPL(ide_pci_remove); EXPORT_SYMBOL_GPL(ide_pci_remove);
#ifdef CONFIG_PM
int ide_pci_suspend(struct pci_dev *dev, pm_message_t state)
{
pci_save_state(dev);
pci_disable_device(dev);
pci_set_power_state(dev, pci_choose_state(dev, state));
return 0;
}
EXPORT_SYMBOL_GPL(ide_pci_suspend);
int ide_pci_resume(struct pci_dev *dev)
{
struct ide_host *host = pci_get_drvdata(dev);
int rc;
pci_set_power_state(dev, PCI_D0);
rc = pci_enable_device(dev);
if (rc)
return rc;
pci_restore_state(dev);
pci_set_master(dev);
if (host->init_chipset)
host->init_chipset(dev);
return 0;
}
EXPORT_SYMBOL_GPL(ide_pci_resume);
#endif
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/pm.h>
#ifdef CONFIG_BLK_DEV_IDEACPI #ifdef CONFIG_BLK_DEV_IDEACPI
#include <acpi/acpi.h> #include <acpi/acpi.h>
#endif #endif
...@@ -639,6 +640,7 @@ struct ide_host { ...@@ -639,6 +640,7 @@ struct ide_host {
ide_hwif_t *ports[MAX_HWIFS]; ide_hwif_t *ports[MAX_HWIFS];
unsigned int n_ports; unsigned int n_ports;
struct device *dev[2]; struct device *dev[2];
unsigned int (*init_chipset)(struct pci_dev *);
unsigned long host_flags; unsigned long host_flags;
void *host_priv; void *host_priv;
}; };
...@@ -1264,6 +1266,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *, ...@@ -1264,6 +1266,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
const struct ide_port_info *, void *); const struct ide_port_info *, void *);
void ide_pci_remove(struct pci_dev *); void ide_pci_remove(struct pci_dev *);
#ifdef CONFIG_PM
int ide_pci_suspend(struct pci_dev *, pm_message_t);
int ide_pci_resume(struct pci_dev *);
#else
#define ide_pci_suspend NULL
#define ide_pci_resume NULL
#endif
void ide_map_sg(ide_drive_t *, struct request *); void ide_map_sg(ide_drive_t *, struct request *);
void ide_init_sg_cmd(ide_drive_t *, struct request *); void ide_init_sg_cmd(ide_drive_t *, struct request *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment