From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-05 10:42:00
Hi list,
there was a bug report on ohci1394 which seems to be related to the
platform-specific code in the driver. Additional details were posted on
linux1394-user:
http://thread.gmane.org/gmane.linux.kernel.firewire.user/focus=2120
Subject: "strange interaction: ohci1394 and backlight on iBook"
Any ideas? Thanks,
--
Stefan Richter
-=====-=-==- =-== --=-=
http://arcgraph.de/sr/
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2006-11-05 10:54:50
On Sun, 2006-11-05 at 11:41 +0100, Stefan Richter wrote:
Hi list,
there was a bug report on ohci1394 which seems to be related to the
platform-specific code in the driver. Additional details were posted on
linux1394-user:
http://thread.gmane.org/gmane.linux.kernel.firewire.user/focus=2120
Subject: "strange interaction: ohci1394 and backlight on iBook"
Any ideas? Thanks,
The machine check means basically that the chip didn't respond on the
PCI bus. The most probable cause is that something is wrong with the
platform code that switches the chip clock on/off or with the PCI D
state change.
One thing you can check is wether that's always called properly,
especially when starting the chip. Another possibly might be that the
chip needs some time after the clocks are restored to be back online,
thus you might need a delay after the platform code and/or the PCI D
state change before you start poking at registers.
A couple of thing to make sure of:
- On init, call platform code first to bring clocks back up, then only
do the PCI D state transition to D0 (maybe with a delay)
- On rmmod or suspend, call the platform code last, after the D3 state
transition (if any), and make sure the chip's been properly stopped
first.
It might also be useful if there isn't some sort of bad interaction with
sungem which on the same PCI bus and has similar clock control as I've
heard about possible issues on some older chips. Thus, the user could
verify that sungem is allways up and running (link on) during the test
and check if that makes any difference.
Cheers,
Ben.
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-05 11:22:57
Benjamin Herrenschmidt wrote:
The machine check means basically that the chip didn't respond on the
PCI bus. The most probable cause is that something is wrong with the
platform code that switches the chip clock on/off or with the PCI D
state change.
One thing you can check is wether that's always called properly,
especially when starting the chip.
Actually, we have platform code in ohci1394's pci_driver.suspend(),
.resume(), and .remove(), but not in .probe().
.suspend() has:
pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);
.resume() has:
pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 1);
.remove() has:
pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);
pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, of_node, 0, 0);
How about this patch:
@@ -3215,6 +3215,18 @@ static int __devinit ohci1394_pci_probe(structti_ohci*ohci;/* shortcut to currently handled device */resource_size_tohci_base;+#ifdef CONFIG_PPC_PMAC+/* Necessary if ohci1394 was loaded and unloaded before */+if(machine_is(powermac)){+structdevice_node*of_node=pci_device_to_OF_node(dev);++if(of_node)+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,+0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+}+#endif /* CONFIG_PPC_PMAC */+if(pci_enable_device(dev))FAIL(-ENXIO,"Failed to enable OHCI hardware");pci_set_master(dev);
Another possibly might be that the
chip needs some time after the clocks are restored to be back online,
thus you might need a delay after the platform code and/or the PCI D
state change before you start poking at registers.
A couple of thing to make sure of:
- On init, call platform code first to bring clocks back up, then only
do the PCI D state transition to D0 (maybe with a delay)
- On rmmod or suspend, call the platform code last, after the D3 state
transition (if any), and make sure the chip's been properly stopped
first.
It might also be useful if there isn't some sort of bad interaction with
sungem which on the same PCI bus and has similar clock control as I've
heard about possible issues on some older chips. Thus, the user could
verify that sungem is allways up and running (link on) during the test
and check if that makes any difference.
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-05 11:37:27
I wrote:
Benjamin Herrenschmidt wrote:
quoted
The machine check means basically that the chip didn't respond on the
PCI bus. The most probable cause is that something is wrong with the
platform code that switches the chip clock on/off or with the PCI D
state change.
One thing you can check is wether that's always called properly,
especially when starting the chip.
@@ -3215,6 +3215,18 @@ static int __devinit ohci1394_pci_probe(structti_ohci*ohci;/* shortcut to currently handled device */resource_size_tohci_base;+#ifdef CONFIG_PPC_PMAC+/* Necessary if ohci1394 was loaded and unloaded before */+if(machine_is(powermac)){+structdevice_node*of_node=pci_device_to_OF_node(dev);++if(of_node)+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,+0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+}+#endif /* CONFIG_PPC_PMAC */+if(pci_enable_device(dev))FAIL(-ENXIO,"Failed to enable OHCI hardware");pci_set_master(dev);
[...]
Hm. There is the following comment in ohci1394_pci_remove():
/* On UniNorth, power down the cable and turn off the chip
* clock when the module is removed to save power on
* laptops. Turning it back ON is done by the arch code when
* pci_enable_device() is called */
Is this true or wrong in current kernels?
--
Stefan Richter
-=====-=-==- =-== --=-=
http://arcgraph.de/sr/
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2006-11-05 12:59:13
Hm. There is the following comment in ohci1394_pci_remove():
/* On UniNorth, power down the cable and turn off the chip
* clock when the module is removed to save power on
* laptops. Turning it back ON is done by the arch code when
* pci_enable_device() is called */
Is this true or wrong in current kernels?
This patch does not help. Doing an ip link set dev eth0 up makes no
difference.
What about trying to add a delay between the pmac clock code and the
init of the controller ? does that help ?
(You need to have a cable plug and the interface up for the power
management bits not to get in the way btw)
Ben.
This patch does not help. Doing an ip link set dev eth0 up makes no
difference.
What about trying to add a delay between the pmac clock code and the
init of the controller ? does that help ?
no. and it is the rmmod, not the insmod, that hangs the pismo.
Adding some mdelay to the remove function doesnt help either.
Tried not calling the pmac feature stuff at all in the rmmod ?
I reckon there might be a problem with the cable power control on some
old models like... the pismo :-)
Ben.
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-10 22:40:39
On 7 Nov, Benjamin Herrenschmidt wrote:
On Tue, 2006-11-07 at 08:08 +0100, Olaf Hering wrote:
[...]
quoted
and it is the rmmod, not the insmod, that hangs the pismo.
Adding some mdelay to the remove function doesnt help either.
Tried not calling the pmac feature stuff at all in the rmmod ?
Olaf?
I reckon there might be a problem with the cable power control on some
old models like... the pismo :-)
Is there a way to detect affected machines or at least to blacklist
known broken machines?
--
Stefan Richter
-=====-=-==- =-== -=-=-
http://arcgraph.de/sr/
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-10 22:43:58
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=7431 :
iBook G3 threw a machine check exception and put the display backlight
to full brightness after ohci1394 was unloaded and reloaded.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/ieee1394/ohci1394.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
Index: linux/drivers/ieee1394/ohci1394.c
===================================================================
@@ -3215,6 +3215,18 @@ static int __devinit ohci1394_pci_probe(structti_ohci*ohci;/* shortcut to currently handled device */resource_size_tohci_base;+#ifdef CONFIG_PPC_PMAC+/* Necessary on some machines if ohci1394 was loaded/ unloaded before */+if(machine_is(powermac)){+structdevice_node*of_node=pci_device_to_OF_node(dev);++if(of_node)+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,+0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+}+#endif /* CONFIG_PPC_PMAC */+if(pci_enable_device(dev))FAIL(-ENXIO,"Failed to enable OHCI hardware");pci_set_master(dev);
@@ -3503,10 +3515,8 @@ static void ohci1394_pci_remove(struct p#endif#ifdef CONFIG_PPC_PMAC-/* On UniNorth, power down the cable and turn off the chip-*clockwhenthemoduleisremovedtosavepoweron-*laptops.TurningitbackONisdonebythearchcodewhen-*pci_enable_device()iscalled*/+/* On UniNorth, power down the cable and turn off the chip clock+*tosavepoweronlaptops*/{structdevice_node*of_node;
@@ -3218,12 +3218,11 @@ static int __devinit ohci1394_pci_probe(#ifdef CONFIG_PPC_PMAC/* Necessary on some machines if ohci1394 was loaded/ unloaded before */if(machine_is(powermac)){-structdevice_node*of_node=pci_device_to_OF_node(dev);+structdevice_node*ofn=pci_device_to_OF_node(dev);-if(of_node)-pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,-0,1);-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+if(ofn)+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,ofn,0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,1);}#endif /* CONFIG_PPC_PMAC */
@@ -3518,12 +3517,11 @@ static void ohci1394_pci_remove(struct p/* On UniNorth, power down the cable and turn off the chip clock*tosavepoweronlaptops*/{-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(ohci->dev);-of_node=pci_device_to_OF_node(ohci->dev);-if(of_node){-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,0);-pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,0,0);+if(ofn){+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,0);+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,ofn,0,0);}}#endif /* CONFIG_PPC_PMAC */
@@ -3583,12 +3581,10 @@ static int ohci1394_pci_suspend(struct p/* PowerMac suspend code comes last */#ifdef CONFIG_PPC_PMACif(machine_is(powermac)){-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(pdev);-/* Disable 1394 */-of_node=pci_device_to_OF_node(pdev);-if(of_node)-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,0);+if(ofn)+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,0);}#endif /* CONFIG_PPC_PMAC */
@@ -3610,12 +3606,10 @@ static int ohci1394_pci_resume(struct pc/* PowerMac resume code comes first */#ifdef CONFIG_PPC_PMACif(machine_is(powermac)){-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(pdev);-/* Re-enable 1394 */-of_node=pci_device_to_OF_node(pdev);-if(of_node)-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+if(ofn)+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,1);}#endif /* CONFIG_PPC_PMAC */
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-10 23:07:21
I wrote:
On 7 Nov, Benjamin Herrenschmidt wrote:
quoted
On Tue, 2006-11-07 at 08:08 +0100, Olaf Hering wrote:
[...]
quoted
quoted
and it is the rmmod, not the insmod, that hangs the pismo.
Adding some mdelay to the remove function doesnt help either.
Tried not calling the pmac feature stuff at all in the rmmod ?
Olaf?
quoted
I reckon there might be a problem with the cable power control on some
old models like... the pismo :-)
Is there a way to detect affected machines or at least to blacklist
known broken machines?
Actually, shouldn't ohci1394_pci_remove enlcose the platform code into
if (machine_is(powermac)) {
...
}
like ohci1394_pci_suspend and ohci1394_pci_resume do?
--
Stefan Richter
-=====-=-==- =-== -=-==
http://arcgraph.de/sr/
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2006-11-10 23:10:19
On Sat, 2006-11-11 at 00:07 +0100, Stefan Richter wrote:
I wrote:
quoted
On 7 Nov, Benjamin Herrenschmidt wrote:
quoted
On Tue, 2006-11-07 at 08:08 +0100, Olaf Hering wrote:
[...]
quoted
quoted
and it is the rmmod, not the insmod, that hangs the pismo.
Adding some mdelay to the remove function doesnt help either.
Tried not calling the pmac feature stuff at all in the rmmod ?
Olaf?
quoted
I reckon there might be a problem with the cable power control on some
old models like... the pismo :-)
Is there a way to detect affected machines or at least to blacklist
known broken machines?
Actually, shouldn't ohci1394_pci_remove enlcose the platform code into
if (machine_is(powermac)) {
...
}
like ohci1394_pci_suspend and ohci1394_pci_resume do?
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-10 23:23:01
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=7431
iBook G3 threw a machine check exception and put the display backlight
to full brightness after ohci1394 was unloaded and reloaded.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
Patch update: There were braces missing. Thanks to Jens Maurer.
drivers/ieee1394/ohci1394.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
Index: linux/drivers/ieee1394/ohci1394.c
===================================================================
@@ -3215,6 +3215,19 @@ static int __devinit ohci1394_pci_probe(structti_ohci*ohci;/* shortcut to currently handled device */resource_size_tohci_base;+#ifdef CONFIG_PPC_PMAC+/* Necessary on some machines if ohci1394 was loaded/ unloaded before */+if(machine_is(powermac)){+structdevice_node*of_node=pci_device_to_OF_node(dev);++if(of_node){+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,+0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+}+}+#endif /* CONFIG_PPC_PMAC */+if(pci_enable_device(dev))FAIL(-ENXIO,"Failed to enable OHCI hardware");pci_set_master(dev);
@@ -3503,10 +3516,8 @@ static void ohci1394_pci_remove(struct p#endif#ifdef CONFIG_PPC_PMAC-/* On UniNorth, power down the cable and turn off the chip-*clockwhenthemoduleisremovedtosavepoweron-*laptops.TurningitbackONisdonebythearchcodewhen-*pci_enable_device()iscalled*/+/* On UniNorth, power down the cable and turn off the chip clock+*tosavepoweronlaptops*/{structdevice_node*of_node;
@@ -3218,12 +3218,11 @@ static int __devinit ohci1394_pci_probe(#ifdef CONFIG_PPC_PMAC/* Necessary on some machines if ohci1394 was loaded/ unloaded before */if(machine_is(powermac)){-structdevice_node*of_node=pci_device_to_OF_node(dev);+structdevice_node*ofn=pci_device_to_OF_node(dev);-if(of_node){-pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,-0,1);-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+if(ofn){+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,ofn,0,1);+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,1);}}#endif /* CONFIG_PPC_PMAC */
@@ -3519,12 +3518,11 @@ static void ohci1394_pci_remove(struct p/* On UniNorth, power down the cable and turn off the chip clock*tosavepoweronlaptops*/{-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(ohci->dev);-of_node=pci_device_to_OF_node(ohci->dev);-if(of_node){-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,0);-pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,of_node,0,0);+if(ofn){+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,0);+pmac_call_feature(PMAC_FTR_1394_CABLE_POWER,ofn,0,0);}}#endif /* CONFIG_PPC_PMAC */
@@ -3584,12 +3582,10 @@ static int ohci1394_pci_suspend(struct p/* PowerMac suspend code comes last */#ifdef CONFIG_PPC_PMACif(machine_is(powermac)){-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(pdev);-/* Disable 1394 */-of_node=pci_device_to_OF_node(pdev);-if(of_node)-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,0);+if(ofn)+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,0);}#endif /* CONFIG_PPC_PMAC */
@@ -3611,12 +3607,10 @@ static int ohci1394_pci_resume(struct pc/* PowerMac resume code comes first */#ifdef CONFIG_PPC_PMACif(machine_is(powermac)){-structdevice_node*of_node;+structdevice_node*ofn=pci_device_to_OF_node(pdev);-/* Re-enable 1394 */-of_node=pci_device_to_OF_node(pdev);-if(of_node)-pmac_call_feature(PMAC_FTR_1394_ENABLE,of_node,0,1);+if(ofn)+pmac_call_feature(PMAC_FTR_1394_ENABLE,ofn,0,1);}#endif /* CONFIG_PPC_PMAC */
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-10 23:27:03
There has been an if(...) missing, for ages.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/ieee1394/ohci1394.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: linux/drivers/ieee1394/ohci1394.c
===================================================================
@@ -3517,7 +3517,7 @@ static void ohci1394_pci_remove(struct p#ifdef CONFIG_PPC_PMAC/* On UniNorth, power down the cable and turn off the chip clock*tosavepoweronlaptops*/-{+if(machine_is(powermac)){structdevice_node*ofn=pci_device_to_OF_node(ohci->dev);if(ofn){
From: Olaf Hering <hidden> Date: 2006-11-13 18:03:33
On Fri, Nov 10, Stefan Richter wrote:
On 7 Nov, Benjamin Herrenschmidt wrote:
quoted
On Tue, 2006-11-07 at 08:08 +0100, Olaf Hering wrote:
[...]
quoted
quoted
and it is the rmmod, not the insmod, that hangs the pismo.
Adding some mdelay to the remove function doesnt help either.
Tried not calling the pmac feature stuff at all in the rmmod ?
Olaf?
The pismo usually locks up after the fist rmmod. With a few delays
around the feature calls, a few more modprobe/rmmod cycles are possible.
But it still locks up after a while.
From: Stefan Richter <stefanr@s5r6.in-berlin.de> Date: 2006-11-13 19:08:20
Olaf Hering wrote:
quoted
On 7 Nov, Benjamin Herrenschmidt wrote:
quoted
Tried not calling the pmac feature stuff at all in the rmmod ?
The pismo usually locks up after the fist rmmod. With a few delays
around the feature calls, a few more modprobe/rmmod cycles are possible.
But it still locks up after a while.
But what if you delete the feature calls from ohci1394_pci_remove?
--
Stefan Richter
-=====-=-==- =-== -==-=
http://arcgraph.de/sr/
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2006-11-14 02:09:54
The pismo usually locks up after the fist rmmod. With a few delays
around the feature calls, a few more modprobe/rmmod cycles are possible.
But it still locks up after a while.
What if you just remove all the feature calls ?
Ben.