···35293529}3530353035313531#ifdef CONFIG_PM35323532-static int ohci1394_pci_resume (struct pci_dev *pdev)35323532+static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state)35333533{35343534 int err;35353535- struct ti_ohci *ohci;35353535+ struct ti_ohci *ohci = pci_get_drvdata(pdev);35363536+35373537+ PRINT(KERN_DEBUG, "suspend called");35383538+ if (!ohci)35393539+ return -ENXIO;35403540+35413541+ /* Clear the async DMA contexts and stop using the controller */35423542+ hpsb_bus_reset(ohci->host);35433543+35443544+ /* See ohci1394_pci_remove() for comments on this sequence */35453545+ reg_write(ohci, OHCI1394_ConfigROMhdr, 0);35463546+ reg_write(ohci, OHCI1394_BusOptions,35473547+ (reg_read(ohci, OHCI1394_BusOptions) & 0x0000f007) |35483548+ 0x00ff0000);35493549+ reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);35503550+ reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);35513551+ reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff);35523552+ reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff);35533553+ reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff);35543554+ reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff);35553555+ set_phy_reg(ohci, 4, ~0xc0 & get_phy_reg(ohci, 4));35563556+ reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff);35573557+ ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT);35583558+ ohci_soft_reset(ohci);35593559+35603560+ err = pci_save_state(pdev);35613561+ if (err)35623562+ return err;35633563+ err = pci_set_power_state(pdev, pci_choose_state(pdev, state));35643564+ if (err)35653565+ return err;35663566+35673567+/* PowerMac suspend code comes last */35683568+#ifdef CONFIG_PPC_PMAC35693569+ if (machine_is(powermac)) {35703570+ struct device_node *of_node;35713571+35723572+ /* Disable 1394 */35733573+ of_node = pci_device_to_OF_node (pdev);35743574+ if (of_node)35753575+ pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);35763576+ }35773577+#endif /* CONFIG_PPC_PMAC */35783578+35793579+ return 0;35803580+}35813581+35823582+static int ohci1394_pci_resume(struct pci_dev *pdev)35833583+{35843584+ int err;35853585+ struct ti_ohci *ohci = pci_get_drvdata(pdev);35863586+35873587+ PRINT(KERN_DEBUG, "resume called");35883588+ if (!ohci)35893589+ return -ENXIO;3536359035373591/* PowerMac resume code comes first */35383592#ifdef CONFIG_PPC_PMAC···36063552 if (err)36073553 return err;3608355436093609- ohci = pci_get_drvdata(pdev);36103610- if (!ohci)36113611- return -1; /* or which exit status to use? */36123612-36133613- PRINT(KERN_DEBUG, "resume called");36143614-36153615- /* The following lines are copied from ohci1394_pci_probe(): */36163616-36173617- /* Start off with a soft reset, to clear everything to a sane36183618- * state. */35553555+ /* See ohci1394_pci_probe() for comments on this sequence */36193556 ohci_soft_reset(ohci);36203620-36213621- /* Now enable LPS, which we need in order to start accessing36223622- * most of the registers. In fact, on some cards (ALI M5251),36233623- * accessing registers in the SClk domain without LPS enabled36243624- * will lock up the machine. Wait 50msec to make sure we have36253625- * full link enabled. */36263557 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS);36273627-36283628- /* Disable and clear interrupts */36293558 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);36303559 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);36313631-36323560 mdelay(50);36333633-36343561 ohci_initialize(ohci);3635356236363563 return 0;36373637-}36383638-36393639-static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)36403640-{36413641- int err;36423642- struct ti_ohci *ohci;36433643-36443644- ohci = pci_get_drvdata(pdev);36453645- if (!ohci)36463646- return -1; /* Not sure if this is the correct return code */36473647-36483648- PRINT(KERN_DEBUG, "suspend called");36493649-36503650- /* clear the async DMA contexts and stop using the controller: */36513651- hpsb_bus_reset(ohci->host);36523652-36533653- /* The following calls are from ohci1394_pci_remove(): */36543654-36553655- /* Clear out BUS Options */36563656- reg_write(ohci, OHCI1394_ConfigROMhdr, 0);36573657- reg_write(ohci, OHCI1394_BusOptions,36583658- (reg_read(ohci, OHCI1394_BusOptions) & 0x0000f007) |36593659- 0x00ff0000);36603660-36613661- /* Clear interrupt registers */36623662- reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);36633663- reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);36643664- reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff);36653665- reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff);36663666- reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff);36673667- reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff);36683668-36693669- /* Disable IRM Contender */36703670- set_phy_reg(ohci, 4, ~0xc0 & get_phy_reg(ohci, 4));36713671-36723672- /* Clear link control register */36733673- reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff);36743674-36753675- /* Let all other nodes know to ignore us */36763676- ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT);36773677-36783678- /* This stops all DMA contexts, disables interrupts,36793679- * and clears linkEnable and LPS: */36803680- ohci_soft_reset(ohci);36813681-36823682- err = pci_save_state(pdev);36833683- if (err)36843684- goto out;36853685- err = pci_set_power_state(pdev, pci_choose_state(pdev, state));36863686- if (err)36873687- goto out;36883688-36893689-/* PowerMac suspend code comes last */36903690-#ifdef CONFIG_PPC_PMAC36913691- if (machine_is(powermac)) {36923692- struct device_node *of_node;36933693-36943694- /* Disable 1394 */36953695- of_node = pci_device_to_OF_node (pdev);36963696- if (of_node)36973697- pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);36983698- }36993699-#endif /* CONFIG_PPC_PMAC */37003700-out:37013701- return err;37023564}37033565#endif /* CONFIG_PM */37043566