* MPC7448_HPC2 question
@ 2006-10-25 5:20 Benjamin Herrenschmidt
2006-10-25 5:31 ` Zang Roy-r61911
2006-10-25 9:31 ` Zang Roy-r61911
0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-25 5:20 UTC (permalink / raw)
To: Roy Zang; +Cc: linuxppc-dev list
Any reason why that:
void mpc7448_hpc2_fixup_irq(struct pci_dev *dev)
{
struct pci_controller *hose;
struct device_node *node;
const unsigned int *interrupt;
int busnr;
int len;
u8 slot;
u8 pin;
/* Lookup the hose */
busnr = dev->bus->number;
hose = pci_bus_to_hose(busnr);
if (!hose)
printk(KERN_ERR "No pci hose found\n");
/* Check it has an OF node associated */
node = (struct device_node *) hose->arch_data;
if (!node)
printk(KERN_ERR "No pci node found\n");
interrupt = get_property(node, "interrupt-map", &len);
slot = find_slot_by_devfn(interrupt, dev->devfn);
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (pin == 0 || pin > 4)
pin = 1;
pin--;
dev->irq = interrupt[slot*4*7 + pin*7 + 5];
DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq);
}
Cannot be replaced by:
pci_read_irq_line(dev);
I'm about to make pci_read_irq_line() called by default by the PCI
code (with a new ppc_md.pci_irq_fixup for platforms that really need
something else done) and so while "fixing" all platforms, I stumbled
accross the code above which is a bit shocking :)
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: MPC7448_HPC2 question
2006-10-25 5:20 MPC7448_HPC2 question Benjamin Herrenschmidt
@ 2006-10-25 5:31 ` Zang Roy-r61911
2006-10-25 9:31 ` Zang Roy-r61911
1 sibling, 0 replies; 5+ messages in thread
From: Zang Roy-r61911 @ 2006-10-25 5:31 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
On Wed, 2006-10-25 at 13:20, Benjamin Herrenschmidt wrote:
> Any reason why that:
>
> void mpc7448_hpc2_fixup_irq(struct pci_dev *dev)
> {
> struct pci_controller *hose;
> struct device_node *node;
> const unsigned int *interrupt;
> int busnr;
> int len;
> u8 slot;
> u8 pin;
>
> /* Lookup the hose */
> busnr = dev->bus->number;
> hose = pci_bus_to_hose(busnr);
> if (!hose)
> printk(KERN_ERR "No pci hose found\n");
>
> /* Check it has an OF node associated */
> node = (struct device_node *) hose->arch_data;
> if (!node)
> printk(KERN_ERR "No pci node found\n");
>
> interrupt = get_property(node, "interrupt-map", &len);
> slot = find_slot_by_devfn(interrupt, dev->devfn);
> pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
> if (pin == 0 || pin > 4)
> pin = 1;
> pin--;
> dev->irq = interrupt[slot*4*7 + pin*7 + 5];
> DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq);
> }
>
> Cannot be replaced by:
>
> pci_read_irq_line(dev);
>
> I'm about to make pci_read_irq_line() called by default by the PCI
> code (with a new ppc_md.pci_irq_fixup for platforms that really need
> something else done) and so while "fixing" all platforms, I stumbled
> accross the code above which is a bit shocking :)
>
> Cheers,
>
> Ben.
>
>
>
Ben,
Last week, I had tried to do the replacement. While, it did not work. I
had though some update of pci_read_irq_line() should be needed.
Any way, I will investigate it and give the patch ASAP :-).
Roy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: MPC7448_HPC2 question
2006-10-25 5:20 MPC7448_HPC2 question Benjamin Herrenschmidt
2006-10-25 5:31 ` Zang Roy-r61911
@ 2006-10-25 9:31 ` Zang Roy-r61911
2006-10-25 13:45 ` Benjamin Herrenschmidt
1 sibling, 1 reply; 5+ messages in thread
From: Zang Roy-r61911 @ 2006-10-25 9:31 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Alexandre.Bounine@tundra.com
On Wed, 2006-10-25 at 13:20, Benjamin Herrenschmidt wrote:
>
> Cannot be replaced by:
>
> pci_read_irq_line(dev);
When I use pci_read_irq_line(), the pci interrupt number exceeds the
limit of mpic-> irq_count. my mpic->irq_count = 0x18, which is gotten
from on chip register.
mpic_host_map() can not return successful value.
Roy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MPC7448_HPC2 question
2006-10-25 9:31 ` Zang Roy-r61911
@ 2006-10-25 13:45 ` Benjamin Herrenschmidt
2006-10-26 7:59 ` Zang Roy-r61911
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-25 13:45 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Alexandre.Bounine@tundra.com
On Wed, 2006-10-25 at 17:31 +0800, Zang Roy-r61911 wrote:
> On Wed, 2006-10-25 at 13:20, Benjamin Herrenschmidt wrote:
>
> >
> > Cannot be replaced by:
> >
> > pci_read_irq_line(dev);
>
> When I use pci_read_irq_line(), the pci interrupt number exceeds the
> limit of mpic-> irq_count. my mpic->irq_count = 0x18, which is gotten
> from on chip register.
>
> mpic_host_map() can not return successful value.
That is not normal... Something must be wrong with your code or your
DT... can you get more details about what precisely is happening in both
cases ?
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MPC7448_HPC2 question
2006-10-25 13:45 ` Benjamin Herrenschmidt
@ 2006-10-26 7:59 ` Zang Roy-r61911
0 siblings, 0 replies; 5+ messages in thread
From: Zang Roy-r61911 @ 2006-10-26 7:59 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Alexandre.Bounine@tundra.com
On Wed, 2006-10-25 at 21:45, Benjamin Herrenschmidt wrote:
> On Wed, 2006-10-25 at 17:31 +0800, Zang Roy-r61911 wrote:
> > On Wed, 2006-10-25 at 13:20, Benjamin Herrenschmidt wrote:
> >
> > >
> > > Cannot be replaced by:
> > >
> > > pci_read_irq_line(dev);
> >
> > When I use pci_read_irq_line(), the pci interrupt number exceeds the
> > limit of mpic-> irq_count. my mpic->irq_count = 0x18, which is
> gotten
> > from on chip register.
> >
> > mpic_host_map() can not return successful value.
>
> That is not normal... Something must be wrong with your code or your
> DT... can you get more details about what precisely is happening in
> both
> cases ?
>
> Ben.
>
I think I have gotten the point. For tsi108/9, there are 24 internal
interrupt. PCI/INTA to PCI/INTD are routed to interrupt 23 with a
special mechanism on the chip. INTA to INTD are assiged to nubmer 36 to
39, which are exceed the nubmer irq number assigned in mpic_alloc().
This cause abnormal return in function pci_read_irq_line().
I have worked out a patch. after a test, I will publish it.
Roy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-26 7:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-25 5:20 MPC7448_HPC2 question Benjamin Herrenschmidt
2006-10-25 5:31 ` Zang Roy-r61911
2006-10-25 9:31 ` Zang Roy-r61911
2006-10-25 13:45 ` Benjamin Herrenschmidt
2006-10-26 7:59 ` Zang Roy-r61911
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).