* [Fwd: Re: ohci1394: steps to implement suspend/resume]
@ 2006-09-06 14:46 Stefan Richter
2006-09-07 0:53 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Richter @ 2006-09-06 14:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: linux1394-devel, Pavel Machek, Bernhard Kaindl
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
Hello LinuxPPC-dev,
we have now patches coming in to fix up the lack of generic suspend +
resume support in drivers/ieee1394/ohci1394. Attached is the latest and
by far most functional one by Bernhard Kaindl. A big question is how
this relates to the already existing PPC-PMAC platform code in
ohci1394's suspend and resume hooks.
- Which functionalities does the existing platform code provide in
detail?
- Do we have to keep platform code and generic code separate? I.e.
#ifdef CONFIG_PPC_PMAC
...pmac_call_feature...
#else
...new generic code...
#endif
- Or are parts of the until now missing, new generic code necessary
for PMacs too? If yes, is the platform code treated to be the lowest
level as far as the oreder of code is concerned?
- Or would the platform code be obsolete?
We already broke your platform code once by what was meant as a bugfix
for non-PMacs. It'd be good to know enough to not repeat such mistakes...
Thanks in advance,
--
Stefan Richter
-=====-=-==- =--= --==-
http://arcgraph.de/sr/
[-- Attachment #2: Re: ohci1394: steps to implement suspend/resume --]
[-- Type: message/rfc822, Size: 8119 bytes --]
From: Bernhard Kaindl <bk@fsfe.org>
To: linux1394-devel@lists.sourceforge.net
Subject: Re: ohci1394: steps to implement suspend/resume
Date: Wed, 6 Sep 2006 14:58:30 +0200 (CEST)
Message-ID: <Pine.LNX.4.64.0609061417580.32750@apunkt.ffii.org>
Hi,
I did a quick shot on what I described and the appended patch
does the first thing needed for working suspend/resume
in ohci1394 which is HW de- and re-initialisation.
It works with suspend2disk on my Ricoh R5C552 IEEE 1394 Controller
with the 2.6.17 kernel to the extent that if I call dvgrab --interactive
after suspend2disk without unloading ohci1394, it does not lock up
dvgrab with 100% CPU but properly connects to the camera, given
that I first unplug and plug the camera after coming back from
suspend.
I guess that could be fixed by forcing a bus reset in the resume
function.
I cannot test suspend to RAM here at the moment and should
follow the guidelines in Documentation/power/pci.txt also,
so this is rather a quick report than a finished patch and
there are some rough edges:
However, with this patch, I have to unload at least some in-kernel
users of ohci1394 like dv1394 or video1394 before suspending.
Not doing that caused an Oops and a bad tasklet error, probably from
not handling ISO tasklets during suspend/resume properly.
Maybe these can be temporarily cleared or unregistered and
re-registered for suspend/resume with help from the other
layers or from the highlevel 1394 core, but I do not really
know what these do.
But this patch provides a useful base to start from and is
already of much help for people which do not need dv1394
and video1394 or can unload them at least during suspend.
I cannot test function with sbp2 at the moment, but raw1394
seems to work fine.
Bernhard
PS: ohci1394-suspendresume-v1.patch:
Signed-Off-By: Bernhard Kaindl <bk@fsfe.org>
(I'm only a normal paying FSFE-Fellow)
--- drivers/ieee1394/ohci1394.c
+++ drivers/ieee1394/ohci1394.c
@@ -3528,6 +3530,8 @@
static int ohci1394_pci_resume (struct pci_dev *pdev)
{
+ struct ti_ohci *ohci;
+
#ifdef CONFIG_PPC_PMAC
if (machine_is(powermac)) {
struct device_node *of_node;
@@ -3541,12 +3545,41 @@
pci_enable_device(pdev);
+ ohci = pci_get_drvdata(pdev);
+ if (!ohci)
+ return -1; // or which exit status to use?
+
+ PRINT(KERN_DEBUG, "resume called");
+
+ /* The following lines are copied from ohci1394_pci_probe(): */
+
+ /* Start off with a soft reset, to clear everything to a sane
+ * state. */
+ ohci_soft_reset(ohci);
+
+ /* Now enable LPS, which we need in order to start accessing
+ * most of the registers. In fact, on some cards (ALI M5251),
+ * accessing registers in the SClk domain without LPS enabled
+ * will lock up the machine. Wait 50msec to make sure we have
+ * full link enabled. */
+ reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS);
+
+ /* Disable and clear interrupts */
+ reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);
+
+ mdelay(50);
+
+ ohci_initialize(ohci);
+
return 0;
}
static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
{
+ struct ti_ohci *ohci;
+
#ifdef CONFIG_PPC_PMAC
if (machine_is(powermac)) {
struct device_node *of_node;
@@ -3558,6 +3591,44 @@
}
#endif
+ ohci = pci_get_drvdata(pdev);
+ if (!ohci)
+ return -1; // Not sure if this is the correct return code
+
+ PRINT(KERN_DEBUG, "suspend called");
+
+ /* clear the async DMA contexts and stop using the controller: */
+ hpsb_bus_reset(ohci->host);
+
+ /* The following calls are from ohci1394_pci_remove(): */
+
+ /* Clear out BUS Options */
+ reg_write(ohci, OHCI1394_ConfigROMhdr, 0);
+ reg_write(ohci, OHCI1394_BusOptions,
+ (reg_read(ohci, OHCI1394_BusOptions) & 0x0000f007) |
+ 0x00ff0000);
+
+ /* Clear interrupt registers */
+ reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff);
+ reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff);
+
+ /* Disable IRM Contender */
+ set_phy_reg(ohci, 4, ~0xc0 & get_phy_reg(ohci, 4));
+
+ /* Clear link control register */
+ reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff);
+
+ /* Let all other nodes know to ignore us */
+ ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT);
+
+ /* This stops all DMA contexts, disables interrupts,
+ * and clears linkEnable and LPS: */
+ ohci_soft_reset(ohci);
+
return 0;
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Fwd: Re: ohci1394: steps to implement suspend/resume]
2006-09-06 14:46 [Fwd: Re: ohci1394: steps to implement suspend/resume] Stefan Richter
@ 2006-09-07 0:53 ` Benjamin Herrenschmidt
2006-09-07 19:34 ` Stefan Richter
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-07 0:53 UTC (permalink / raw)
To: Stefan Richter
Cc: linuxppc-dev, linux1394-devel, Bernhard Kaindl, Pavel Machek
On Wed, 2006-09-06 at 16:46 +0200, Stefan Richter wrote:
> Hello LinuxPPC-dev,
>
> we have now patches coming in to fix up the lack of generic suspend +
> resume support in drivers/ieee1394/ohci1394. Attached is the latest and
> by far most functional one by Bernhard Kaindl. A big question is how
> this relates to the already existing PPC-PMAC platform code in
> ohci1394's suspend and resume hooks.
>
> - Which functionalities does the existing platform code provide in
> detail?
>
> - Do we have to keep platform code and generic code separate? I.e.
> #ifdef CONFIG_PPC_PMAC
> ...pmac_call_feature...
> #else
> ...new generic code...
> #endif
>
> - Or are parts of the until now missing, new generic code necessary
> for PMacs too? If yes, is the platform code treated to be the lowest
> level as far as the oreder of code is concerned?
>
> - Or would the platform code be obsolete?
>
> We already broke your platform code once by what was meant as a bugfix
> for non-PMacs. It'd be good to know enough to not repeat such mistakes...
The PowerMac code will stop the chip clocks. It should be used as the
last step of the suspend sequence and first step of the return sequence,
in _addition_ to your new code. Note also that the code you posted lacks
calls to pci_set_power_state()...
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fwd: Re: ohci1394: steps to implement suspend/resume]
2006-09-07 0:53 ` Benjamin Herrenschmidt
@ 2006-09-07 19:34 ` Stefan Richter
2006-09-07 23:30 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Richter @ 2006-09-07 19:34 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, linux1394-devel, Bernhard Kaindl, Pavel Machek
Benjamin Herrenschmidt wrote:
> On Wed, 2006-09-06 at 16:46 +0200, Stefan Richter wrote:
[...]
>> We already broke your platform code once by what was meant as a bugfix
>> for non-PMacs. It'd be good to know enough to not repeat such mistakes...
>
> The PowerMac code will stop the chip clocks. It should be used as the
> last step of the suspend sequence and first step of the return sequence,
> in _addition_ to your new code.
Thanks for the help.
> Note also that the code you posted lacks calls to pci_set_power_state()...
Pavel submitted a respective patch on 2006-09-05; I will integrate them
both.
--
Stefan Richter
-=====-=-==- =--= --===
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fwd: Re: ohci1394: steps to implement suspend/resume]
2006-09-07 19:34 ` Stefan Richter
@ 2006-09-07 23:30 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-07 23:30 UTC (permalink / raw)
To: Stefan Richter
Cc: linuxppc-dev, linux1394-devel, Bernhard Kaindl, Pavel Machek
On Thu, 2006-09-07 at 21:34 +0200, Stefan Richter wrote:
> Benjamin Herrenschmidt wrote:
> > On Wed, 2006-09-06 at 16:46 +0200, Stefan Richter wrote:
> [...]
> >> We already broke your platform code once by what was meant as a bugfix
> >> for non-PMacs. It'd be good to know enough to not repeat such mistakes...
> >
> > The PowerMac code will stop the chip clocks. It should be used as the
> > last step of the suspend sequence and first step of the return sequence,
> > in _addition_ to your new code.
>
> Thanks for the help.
np. I'll try to test if I find some time :)
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-07 23:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-06 14:46 [Fwd: Re: ohci1394: steps to implement suspend/resume] Stefan Richter
2006-09-07 0:53 ` Benjamin Herrenschmidt
2006-09-07 19:34 ` Stefan Richter
2006-09-07 23:30 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).