* Re: Problem in pmac PCI fixup
2002-04-28 15:25 Problem in pmac PCI fixup Michel Lanners
@ 2002-04-28 15:16 ` Benjamin Herrenschmidt
2002-04-29 19:34 ` Michel Lanners
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2002-04-28 15:16 UTC (permalink / raw)
To: mlan, linuxppc-dev
>--- linux-2.4.19-pre6-lvm-gentoo/arch/ppc/kernel/pmac_pci.c Sun Apr
>28 09:14:09 2002
>+++ linux-2.4.16-planb/arch/ppc/kernel/pmac_pci.c Sun Apr
>28 17:18:39 2002
>@@ -493,8 +503,6 @@
> unsigned char pin;
> struct device_node* node;
>
>- if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
>!pin)
>- continue; /* No interrupt generated -> no fixup */
> node = pci_device_to_OF_node(dev);
> if (!node) {
> printk("No OF node for device %x:%x\n", dev->bus-
>>number, dev->devfn >> 3);
>
>Anybody have any problem with that approach?
No problem with that, it's actually what we do in chrp.
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Problem in pmac PCI fixup
@ 2002-04-28 15:25 Michel Lanners
2002-04-28 15:16 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Michel Lanners @ 2002-04-28 15:25 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
I'm about to finish a bit of work on planb, the 7x00/8x00 video input
driver.
It's now in rather good shape (acording to my very low standards ;-);
among other things, it doesn't need to do any PCI fixups by hand
anymore.
Almost, I should add, because there's a problem left with the IRQ. In
fact, the PCI code does not fill pdev->irq for many pmac devices, since
OF doesn't set PCI_INTERRUPT_LINE. Therefore, we have fixup code in
pmac_pci.c; however, that code checks PCI_INTERRUPT_PIN on the device.
Now, the problem is that planb doesn't have a PCI_INTERRUPT_PIN setting,
therefore fixup doesn't get applied. And hardcoding the IRQ in the planb
driver code doesn't seem right....
Since the PCI fixup code is about fixing broken things anyway, I'd
propose we remove the check for PCI_INTERRUPT_PIN and solely rely on OF
properties to see whether there's an interrupt present at all. Patch
would be this here (hand-pasted):
--- linux-2.4.19-pre6-lvm-gentoo/arch/ppc/kernel/pmac_pci.c Sun Apr 28 09:14:09 2002
+++ linux-2.4.16-planb/arch/ppc/kernel/pmac_pci.c Sun Apr 28 17:18:39 2002
@@ -493,8 +503,6 @@
unsigned char pin;
struct device_node* node;
- if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) || !pin)
- continue; /* No interrupt generated -> no fixup */
node = pci_device_to_OF_node(dev);
if (!node) {
printk("No OF node for device %x:%x\n", dev->bus->number, dev->devfn >> 3);
Anybody have any problem with that approach?
Thanks, and cheers
Michel
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem in pmac PCI fixup
2002-04-28 15:16 ` Benjamin Herrenschmidt
@ 2002-04-29 19:34 ` Michel Lanners
0 siblings, 0 replies; 3+ messages in thread
From: Michel Lanners @ 2002-04-29 19:34 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
[-- Attachment #1: Type: TEXT/plain, Size: 1369 bytes --]
Hi Ben,
On 28 Apr, this message from Benjamin Herrenschmidt echoed through cyberspace:
>>--- linux-2.4.19-pre6-lvm-gentoo/arch/ppc/kernel/pmac_pci.c Sun Apr
>>28 09:14:09 2002
>>+++ linux-2.4.16-planb/arch/ppc/kernel/pmac_pci.c Sun Apr
>>28 17:18:39 2002
>>@@ -493,8 +503,6 @@
>> unsigned char pin;
>> struct device_node* node;
>>
>>- if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
>>!pin)
>>- continue; /* No interrupt generated -> no fixup */
>> node = pci_device_to_OF_node(dev);
>> if (!node) {
>> printk("No OF node for device %x:%x\n", dev->bus-
>>>number, dev->devfn >> 3);
>>
>>Anybody have any problem with that approach?
>
> No problem with that, it's actually what we do in chrp.
Good then, can you apply the attached patch to any kernel tree within
your reach :) ?
I'll send off the Plan diff privately to you (it's quite a few K in
size...).
Cheers, and thanks
Michel
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
[-- Attachment #2: pci-irq.diff --]
[-- Type: TEXT/plain, Size: 4316 bytes --]
--- linux-2.4.19-pre6-lvm-gentoo/arch/ppc/kernel/pmac_pci.c Sun Apr 28 09:14:09 2002
+++ linux-2.4.16-planb/arch/ppc/kernel/pmac_pci.c Sun Apr 28 17:18:39 2002
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.pmac_pci.c 1.34 03/22/02 10:45:30 benh
+ * BK Id: SCCS/s.pmac_pci.c 1.27 09/08/01 15:47:42 paulus
*/
/*
* Support for PCI bridges found on Power Macintoshes.
@@ -27,7 +27,7 @@
#include <asm/prom.h>
#include <asm/pci-bridge.h>
#include <asm/machdep.h>
-#include <asm/pmac_feature.h>
+#include <asm/feature.h>
#include "pci.h"
@@ -258,12 +258,21 @@
rev = in_8(bp->cfg_data);
if (rev != BANDIT_REVID)
printk(KERN_WARNING
- "Unknown revision %d for bandit\n", rev);
+ "Unknown revision %d for bandit at %08lx\n",
+ rev, bp->io_base_phys);
} else if (vendev != (BANDIT_DEVID_2 << 16) + PCI_VENDOR_ID_APPLE) {
printk(KERN_WARNING "bandit isn't? (%x)\n", vendev);
return;
}
+ /* read the revision id */
+ out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + PCI_REVISION_ID);
+ udelay(2);
+ rev = in_8(bp->cfg_data);
+ if (rev != BANDIT_REVID)
+ printk(KERN_WARNING "Unknown revision %d for bandit at %08lx\n",
+ rev, bp->io_base_phys);
+
/* read the word at offset 0x50 */
out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + BANDIT_MAGIC);
udelay(2);
@@ -273,7 +282,8 @@
magic |= BANDIT_COHERENT;
udelay(2);
out_le32((volatile unsigned int *)bp->cfg_data, magic);
- printk(KERN_INFO "Cache coherency enabled for bandit/PSX\n");
+ printk(KERN_INFO "Cache coherency enabled for bandit/PSX at %08lx\n",
+ bp->io_base_phys);
}
@@ -493,8 +503,6 @@
unsigned char pin;
struct device_node* node;
- if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) || !pin)
- continue; /* No interrupt generated -> no fixup */
node = pci_device_to_OF_node(dev);
if (!node) {
printk("No OF node for device %x:%x\n", dev->bus->number, dev->devfn >> 3);
@@ -519,37 +527,29 @@
{
struct device_node* node;
int updatecfg = 0;
- int uninorth_child;
-
+
node = pci_device_to_OF_node(dev);
-
+
/* We don't want to enable USB controllers absent from the OF tree
* (iBook second controller)
*/
if (dev->vendor == PCI_VENDOR_ID_APPLE
&& dev->device == PCI_DEVICE_ID_APPLE_KL_USB && !node)
return -EINVAL;
-
- if (!node)
- return 0;
-
- uninorth_child = node->parent &&
- device_is_compatible(node->parent, "uni-north");
/* Firewire & GMAC were disabled after PCI probe, the driver is
* claiming them, we must re-enable them now.
*/
- if (uninorth_child && !strcmp(node->name, "firewire") &&
+ if (node && !strcmp(node->name, "firewire") &&
(device_is_compatible(node, "pci106b,18") ||
- device_is_compatible(node, "pci106b,30") ||
- device_is_compatible(node, "pci11c1,5811"))) {
- pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, node, 0, 1);
- pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1);
+ device_is_compatible(node, "pci106b,30"))) {
+ feature_set_firewire_cable_power(node, 1);
+ feature_set_firewire_power(node, 1);
updatecfg = 1;
}
- if (uninorth_child && !strcmp(node->name, "ethernet") &&
+ if (node && !strcmp(node->name, "ethernet") &&
device_is_compatible(node, "gmac")) {
- pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1);
+ feature_set_gmac_power(node, 1);
updatecfg = 1;
}
@@ -606,11 +606,10 @@
nd = find_devices("firewire");
while (nd) {
if (nd->parent && (device_is_compatible(nd, "pci106b,18") ||
- device_is_compatible(nd, "pci106b,30") ||
- device_is_compatible(nd, "pci11c1,5811"))
+ device_is_compatible(nd, "pci106b,30"))
&& device_is_compatible(nd->parent, "uni-north")) {
- pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0);
- pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0);
+ feature_set_firewire_power(nd, 0);
+ feature_set_firewire_cable_power(nd, 0);
}
nd = nd->next;
}
@@ -618,7 +617,7 @@
while (nd) {
if (nd->parent && device_is_compatible(nd, "gmac")
&& device_is_compatible(nd->parent, "uni-north"))
- pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0);
+ feature_set_gmac_power(nd, 0);
nd = nd->next;
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-29 19:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-28 15:25 Problem in pmac PCI fixup Michel Lanners
2002-04-28 15:16 ` Benjamin Herrenschmidt
2002-04-29 19:34 ` Michel Lanners
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).