diff options
author | Stuart Bennett <stuart@freedesktop.org> | 2008-08-12 10:19:18 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-10-16 00:18:20 -0400 |
commit | 2a32c3c894bcd3b3f8cc7e23f5ecbebca4a9f8e8 (patch) | |
tree | 3be28af58a111f31cbc9f7e671b65d2b64bc3bd6 /drivers/char/agp/amd-k7-agp.c | |
parent | 44d494417278e49f5b42bd3ded1801b6d2254db8 (diff) |
agp/amd-k7: Suspend support for AMD K7 GART driver
Reinitialize bridge registers after suspend, but avoid repeating the ioremap
Tested and works on AMD761
Signed-off-by: Stuart Bennett <stuart@freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/agp/amd-k7-agp.c')
-rw-r--r-- | drivers/char/agp/amd-k7-agp.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index e280531843be..c9e3310a7d9d 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -223,12 +223,14 @@ static int amd_irongate_configure(void) | |||
223 | 223 | ||
224 | current_size = A_SIZE_LVL2(agp_bridge->current_size); | 224 | current_size = A_SIZE_LVL2(agp_bridge->current_size); |
225 | 225 | ||
226 | /* Get the memory mapped registers */ | 226 | if (!amd_irongate_private.registers) { |
227 | pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); | 227 | /* Get the memory mapped registers */ |
228 | temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 228 | pci_read_config_dword(agp_bridge->dev, AMD_MMBASE, &temp); |
229 | amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); | 229 | temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
230 | if (!amd_irongate_private.registers) | 230 | amd_irongate_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); |
231 | return -ENOMEM; | 231 | if (!amd_irongate_private.registers) |
232 | return -ENOMEM; | ||
233 | } | ||
232 | 234 | ||
233 | /* Write out the address of the gatt table */ | 235 | /* Write out the address of the gatt table */ |
234 | writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); | 236 | writel(agp_bridge->gatt_bus_addr, amd_irongate_private.registers+AMD_ATTBASE); |
@@ -490,6 +492,26 @@ static void __devexit agp_amdk7_remove(struct pci_dev *pdev) | |||
490 | agp_put_bridge(bridge); | 492 | agp_put_bridge(bridge); |
491 | } | 493 | } |
492 | 494 | ||
495 | #ifdef CONFIG_PM | ||
496 | |||
497 | static int agp_amdk7_suspend(struct pci_dev *pdev, pm_message_t state) | ||
498 | { | ||
499 | pci_save_state(pdev); | ||
500 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
501 | |||
502 | return 0; | ||
503 | } | ||
504 | |||
505 | static int agp_amdk7_resume(struct pci_dev *pdev) | ||
506 | { | ||
507 | pci_set_power_state(pdev, PCI_D0); | ||
508 | pci_restore_state(pdev); | ||
509 | |||
510 | return amd_irongate_driver.configure(); | ||
511 | } | ||
512 | |||
513 | #endif /* CONFIG_PM */ | ||
514 | |||
493 | /* must be the same order as name table above */ | 515 | /* must be the same order as name table above */ |
494 | static struct pci_device_id agp_amdk7_pci_table[] = { | 516 | static struct pci_device_id agp_amdk7_pci_table[] = { |
495 | { | 517 | { |
@@ -526,6 +548,10 @@ static struct pci_driver agp_amdk7_pci_driver = { | |||
526 | .id_table = agp_amdk7_pci_table, | 548 | .id_table = agp_amdk7_pci_table, |
527 | .probe = agp_amdk7_probe, | 549 | .probe = agp_amdk7_probe, |
528 | .remove = agp_amdk7_remove, | 550 | .remove = agp_amdk7_remove, |
551 | #ifdef CONFIG_PM | ||
552 | .suspend = agp_amdk7_suspend, | ||
553 | .resume = agp_amdk7_resume, | ||
554 | #endif | ||
529 | }; | 555 | }; |
530 | 556 | ||
531 | static int __init agp_amdk7_init(void) | 557 | static int __init agp_amdk7_init(void) |