* [PATCH] Fix Maple PATA IRQ assignment.
@ 2007-01-01 19:31 David Woodhouse
2007-01-01 20:10 ` Benjamin Herrenschmidt
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: David Woodhouse @ 2007-01-01 19:31 UTC (permalink / raw)
To: alan, jgarzik; +Cc: linuxppc-dev
On the Maple board, the AMD8111 IDE is in legacy mode... except that it
appears on IRQ 20 instead of IRQ 15. For drivers/ide this was handled by
the architecture's "pci_get_legacy_ide_irq()" function, but in libata we
just hard-code the numbers 14 and 15.
This patch provides asm-powerpc/libata-portmap.h which maps the IRQ as
appropriate, having added a pci_dev argument to the
ATA_{PRIM,SECOND}ARY_IRQ macros.
There's probably a better way to do this -- especially if we observe
that the _only_ case in which this seemingly-generic
"pci_get_legacy_ide_irq()" function returns anything other than 14 and
15 for primary and secondary respectively is the case of the AMD8111 on
the Maple board -- couldn't we handle that with a special case in the
pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
native mode during early boot and assign resources properly?
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0673dbe..1857707 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -484,6 +484,7 @@ config PPC_MAPLE
select PPC_970_NAP
select PPC_NATIVE
select PPC_RTAS
+ select ATA_NONSTANDARD if ATA
default n
help
This option enables support for the Maple 970FX Evaluation Board.
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 7645f2b..bf44f6d 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -879,7 +879,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
probe_ent->n_ports = 2;
if (port_mask & ATA_PORT_PRIMARY) {
- probe_ent->irq = ATA_PRIMARY_IRQ;
+ probe_ent->irq = ATA_PRIMARY_IRQ(pdev);
probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
probe_ent->port[0].altstatus_addr =
probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
@@ -894,9 +894,9 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
if (port_mask & ATA_PORT_SECONDARY) {
if (probe_ent->irq)
- probe_ent->irq2 = ATA_SECONDARY_IRQ;
+ probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev);
else
- probe_ent->irq = ATA_SECONDARY_IRQ;
+ probe_ent->irq = ATA_SECONDARY_IRQ(pdev);
probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
probe_ent->port[1].altstatus_addr =
probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
index 9202fd0..ec742ca 100644
--- a/include/asm-generic/libata-portmap.h
+++ b/include/asm-generic/libata-portmap.h
@@ -1,12 +1,12 @@
#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H
#define __ASM_GENERIC_LIBATA_PORTMAP_H
#define ATA_PRIMARY_CMD 0x1F0
#define ATA_PRIMARY_CTL 0x3F6
-#define ATA_PRIMARY_IRQ 14
+#define ATA_PRIMARY_IRQ(dev) 14
#define ATA_SECONDARY_CMD 0x170
#define ATA_SECONDARY_CTL 0x376
-#define ATA_SECONDARY_IRQ 15
+#define ATA_SECONDARY_IRQ(dev) 15
#endif
--- /dev/null 2006-12-19 10:44:19.206057770 +0000
+++ b/include/asm-powerpc/libata-portmap.h 2006-12-31 00:32:04.000000000 +0000
@@ -0,0 +1,12 @@
+#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
+#define __ASM_POWERPC_LIBATA_PORTMAP_H
+
+#define ATA_PRIMARY_CMD 0x1F0
+#define ATA_PRIMARY_CTL 0x3F6
+#define ATA_PRIMARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 0)
+
+#define ATA_SECONDARY_CMD 0x170
+#define ATA_SECONDARY_CTL 0x376
+#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
+
+#endif
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 03f6338..6a38c9b 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -19,6 +19,10 @@ config ATA
if ATA
+config ATA_NONSTANDARD
+ bool
+ default n
+
config SATA_AHCI
tristate "AHCI SATA support"
depends on PCI
--
dwmw2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
@ 2007-01-01 20:10 ` Benjamin Herrenschmidt
2007-01-01 20:26 ` David Woodhouse
2007-01-01 20:44 ` Segher Boessenkool
2007-01-01 20:42 ` Segher Boessenkool
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-01 20:10 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik, alan
On Mon, 2007-01-01 at 19:31 +0000, David Woodhouse wrote:
> On the Maple board, the AMD8111 IDE is in legacy mode... except that it
> appears on IRQ 20 instead of IRQ 15. For drivers/ide this was handled by
> the architecture's "pci_get_legacy_ide_irq()" function, but in libata we
> just hard-code the numbers 14 and 15.
>
> This patch provides asm-powerpc/libata-portmap.h which maps the IRQ as
> appropriate, having added a pci_dev argument to the
> ATA_{PRIM,SECOND}ARY_IRQ macros.
>
> There's probably a better way to do this -- especially if we observe
> that the _only_ case in which this seemingly-generic
> "pci_get_legacy_ide_irq()" function returns anything other than 14 and
> 15 for primary and secondary respectively is the case of the AMD8111 on
> the Maple board -- couldn't we handle that with a special case in the
> pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
> native mode during early boot and assign resources properly?
I'm not sure you can switch it to native mode in sw... worth double
checking though. All boards based on 8111 on powerpc have this problem,
I think. What of the js20 and js21 with IBM firmware ? Or does it have
the ide strapped to native mode ?
In the meantime, your patch seems like the way to go.
Ben.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 20:10 ` Benjamin Herrenschmidt
@ 2007-01-01 20:26 ` David Woodhouse
2007-01-01 21:23 ` Benjamin Herrenschmidt
2007-01-01 20:44 ` Segher Boessenkool
1 sibling, 1 reply; 16+ messages in thread
From: David Woodhouse @ 2007-01-01 20:26 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, jgarzik, alan
On Tue, 2007-01-02 at 07:10 +1100, Benjamin Herrenschmidt wrote:
>
> I'm not sure you can switch it to native mode in sw... worth double
> checking though. All boards based on 8111 on powerpc have this problem,
> I think. What of the js20 and js21 with IBM firmware ? Or does it have
> the ide strapped to native mode ?
No idea, but it doesn't implement ppc_md.pci_get_legacy_ide_irq(). Only
Maple does -- maybe the others actually manage to route it to IRQ 14 and
15?
Perhaps we could do that on Maple too -- after all, IRQ numbers in Linux
are just a fiction which don't have to match the hardware documentation
in any way.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
2007-01-01 20:10 ` Benjamin Herrenschmidt
@ 2007-01-01 20:42 ` Segher Boessenkool
2007-01-01 20:56 ` David Woodhouse
2007-01-01 21:22 ` Alan
` (2 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Segher Boessenkool @ 2007-01-01 20:42 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik, alan
> On the Maple board, the AMD8111 IDE is in legacy mode... except that it
> appears on IRQ 20 instead of IRQ 15.
How does this work? The hardware routes the EIDE interrupts
to #14/#15 in legacy mode, just like it should. Can you show
the relevant configuration bits please?
Segher
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 20:10 ` Benjamin Herrenschmidt
2007-01-01 20:26 ` David Woodhouse
@ 2007-01-01 20:44 ` Segher Boessenkool
2007-01-01 21:33 ` Benjamin Herrenschmidt
1 sibling, 1 reply; 16+ messages in thread
From: Segher Boessenkool @ 2007-01-01 20:44 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, David Woodhouse, alan, jgarzik
> I'm not sure you can switch it to native mode in sw... worth double
> checking though. All boards based on 8111 on powerpc have this problem,
> I think. What of the js20 and js21 with IBM firmware ?
At least with SLOF, we use native mode.
> Or does it have
> the ide strapped to native mode ?
It's not a strapping, it's a purely software thing -- see the PCIIDE
specification.
Lots of controllers get the interrupt thing wrong though -- but
AMD8111 isn't one of those.
Segher
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 20:42 ` Segher Boessenkool
@ 2007-01-01 20:56 ` David Woodhouse
0 siblings, 0 replies; 16+ messages in thread
From: David Woodhouse @ 2007-01-01 20:56 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, jgarzik, alan
On Mon, 2007-01-01 at 21:42 +0100, Segher Boessenkool wrote:
> > On the Maple board, the AMD8111 IDE is in legacy mode... except that it
> > appears on IRQ 20 instead of IRQ 15.
>
> How does this work? The hardware routes the EIDE interrupts
> to #14/#15 in legacy mode, just like it should. Can you show
> the relevant configuration bits please?
Gladly, if you tell me where to look -- what controls IRQ routing?
Or just give me a SSH public key and poke at it yourself.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 21:22 ` Alan
@ 2007-01-01 21:15 ` David Woodhouse
2007-01-01 21:34 ` Alan
0 siblings, 1 reply; 16+ messages in thread
From: David Woodhouse @ 2007-01-01 21:15 UTC (permalink / raw)
To: Alan; +Cc: linuxppc-dev, jgarzik
On Mon, 2007-01-01 at 21:22 +0000, Alan wrote:
> On Mon, 01 Jan 2007 19:31:15 +0000
> David Woodhouse <dwmw2@infradead.org> wrote:
> > There's probably a better way to do this -- especially if we observe
> > that the _only_ case in which this seemingly-generic
> > "pci_get_legacy_ide_irq()" function returns anything other than 14 and
> > 15 for primary and secondary respectively is the case of the AMD8111 on
> > the Maple board -- couldn't we handle that with a special case in the
> > pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
> > native mode during early boot and assign resources properly?
>
> There are lots of platforms where the primary/secondary address depends
> upon the board/architecture. PPC actually has functions for this in the
> machine specific goo used by the old driver for one example
> >
> > Signed-off-by: David Woodhouse <dwmw2@infradead.org>
>
> NAK: Alan Cox <alan@redhat.com>
>
> Please reuse the existing PPC methods that drivers/ide calls into.
Er, that would be pci_get_legacy_ide_irq(), which is what I _have_ used.
As I said, the Maple board is the _only_ user, across all architectures
and all PowerPC platforms, of pci_get_legacy_ide_irq(). And the AMD74xx
driver is the only driver which calls it -- for Maple. Hence the
suggestion that perhaps there's a better way to do it.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
2007-01-01 20:10 ` Benjamin Herrenschmidt
2007-01-01 20:42 ` Segher Boessenkool
@ 2007-01-01 21:22 ` Alan
2007-01-01 21:15 ` David Woodhouse
2007-01-02 0:18 ` Benjamin Herrenschmidt
2007-01-26 22:28 ` Jeff Garzik
4 siblings, 1 reply; 16+ messages in thread
From: Alan @ 2007-01-01 21:22 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik
On Mon, 01 Jan 2007 19:31:15 +0000
David Woodhouse <dwmw2@infradead.org> wrote:
> There's probably a better way to do this -- especially if we observe
> that the _only_ case in which this seemingly-generic
> "pci_get_legacy_ide_irq()" function returns anything other than 14 and
> 15 for primary and secondary respectively is the case of the AMD8111 on
> the Maple board -- couldn't we handle that with a special case in the
> pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
> native mode during early boot and assign resources properly?
There are lots of platforms where the primary/secondary address depends
upon the board/architecture. PPC actually has functions for this in the
machine specific goo used by the old driver for one example
>
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
NAK: Alan Cox <alan@redhat.com>
Please reuse the existing PPC methods that drivers/ide calls into.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 20:26 ` David Woodhouse
@ 2007-01-01 21:23 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-01 21:23 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik, alan
On Mon, 2007-01-01 at 20:26 +0000, David Woodhouse wrote:
> On Tue, 2007-01-02 at 07:10 +1100, Benjamin Herrenschmidt wrote:
> >
> > I'm not sure you can switch it to native mode in sw... worth double
> > checking though. All boards based on 8111 on powerpc have this problem,
> > I think. What of the js20 and js21 with IBM firmware ? Or does it have
> > the ide strapped to native mode ?
>
> No idea, but it doesn't implement ppc_md.pci_get_legacy_ide_irq(). Only
> Maple does -- maybe the others actually manage to route it to IRQ 14 and
> 15?
Not with the new IRQ numbering scheme in which only a 8259 can get
those. Thus it must be native.
> Perhaps we could do that on Maple too -- after all, IRQ numbers in Linux
> are just a fiction which don't have to match the hardware documentation
> in any way.
I suppose I could add a function to hard-code a mapping but that would
have a few issues with the way I do virtual IRQs... I really assume that
1 to 15 are reserved for 8259. But we can hack it... I'd rather not
though and keep a hook for IDE etc...
There's another problem which is PCI IDE cards with the chip in legacy
mode... I've seen all sort of HW horrors in the area (like routing them
to INT#A and INT#B on a single function, sic....) or there's also the
case of the VIA chipset in pegasos which claims to be native mode but
routes IDE IRQs to 14 and 15 and not PIRQ...
Ben.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 20:44 ` Segher Boessenkool
@ 2007-01-01 21:33 ` Benjamin Herrenschmidt
2007-01-01 22:17 ` Segher Boessenkool
0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-01 21:33 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, David Woodhouse, alan, jgarzik
On Mon, 2007-01-01 at 21:44 +0100, Segher Boessenkool wrote:
> > I'm not sure you can switch it to native mode in sw... worth double
> > checking though. All boards based on 8111 on powerpc have this problem,
> > I think. What of the js20 and js21 with IBM firmware ?
>
> At least with SLOF, we use native mode.
>
> > Or does it have
> > the ide strapped to native mode ?
>
> It's not a strapping, it's a purely software thing -- see the PCIIDE
> specification.
I know the PCI IDE spec, but there are a number of chips out there that
cannot be changed without a strap. In this case, it's easy to test
though we'll need fixups in the device-tree to indicate the change in
routing, or a quirk.
The thing is, there -is- a cascaded 8259 in there, and that's where the
IRQ14 and IRQ15 end up in legacy mode (edge sensitive even) iirc, unless
they are aslo routed to the APIC directly, but in anyway it's hidden by
the firmware.
So we can have a quirk in the Maple code to reconfigure that all in
native mode. That will mean a bit more IRQ sharing since both IDE
channels will suddenly share PIRQA though... along with whatever else
uses that pin. Maybe not the best solution...
Or keep the hook and use it in libata. It makes sense I think in
general. I reckon other platforms might have good use of being able to
"remap" those IRQs 14 and 15 from IDE controllers in legacy mode. I've
seen plenty of cases where they are kept in that mode just to keep the
IRQs non-shared.
> Lots of controllers get the interrupt thing wrong though -- but
> AMD8111 isn't one of those.
Ben.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 21:15 ` David Woodhouse
@ 2007-01-01 21:34 ` Alan
2007-01-01 21:43 ` David Woodhouse
0 siblings, 1 reply; 16+ messages in thread
From: Alan @ 2007-01-01 21:34 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik
> Er, that would be pci_get_legacy_ide_irq(), which is what I _have_ used.
Ok un-NAK that, I didn't realise there was a wrapper to those methods too.
> As I said, the Maple board is the _only_ user, across all architectures
> and all PowerPC platforms, of pci_get_legacy_ide_irq(). And the AMD74xx
The Motorola's also used to use funny IRQ numbers for IDE legacy - or are
they no longer supported
> driver is the only driver which calls it -- for Maple. Hence the
> suggestion that perhaps there's a better way to do it.
IRQ routing is platform not driver. Let's keep it that way.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 21:34 ` Alan
@ 2007-01-01 21:43 ` David Woodhouse
2007-01-02 0:17 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 16+ messages in thread
From: David Woodhouse @ 2007-01-01 21:43 UTC (permalink / raw)
To: Alan; +Cc: linuxppc-dev, jgarzik
On Mon, 2007-01-01 at 21:34 +0000, Alan wrote:
> > Er, that would be pci_get_legacy_ide_irq(), which is what I _have_ used.
>
> Ok un-NAK that, I didn't realise there was a wrapper to those methods too.
>
> > As I said, the Maple board is the _only_ user, across all architectures
> > and all PowerPC platforms, of pci_get_legacy_ide_irq(). And the AMD74xx
>
> The Motorola's also used to use funny IRQ numbers for IDE legacy - or are
> they no longer supported
Well, there's no other implementation of pci_get_legacy_ide_irq() (other
than the default {15,14}) except for Maple, throughout all of arch/ppc
and arch/powerpc.
> > driver is the only driver which calls it -- for Maple. Hence the
> > suggestion that perhaps there's a better way to do it.
>
> IRQ routing is platform not driver. Let's keep it that way.
Well, yes -- that's what my patch does. I was just thinking that since
this is the _only_ platform which currently uses it, it might be worth
fixing it differently -- by changing the platform setup code to either
route the interrupts to match what the generic code expects, or switch
the controller to native mode.
I'm happy enough with the patch I sent too though.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 21:33 ` Benjamin Herrenschmidt
@ 2007-01-01 22:17 ` Segher Boessenkool
0 siblings, 0 replies; 16+ messages in thread
From: Segher Boessenkool @ 2007-01-01 22:17 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, David Woodhouse, alan, jgarzik
>>> Or does it have
>>> the ide strapped to native mode ?
>>
>> It's not a strapping, it's a purely software thing -- see the PCIIDE
>> specification.
>
> I know the PCI IDE spec, but there are a number of chips out there that
> cannot be changed without a strap.
Sure, but not the 8111.
> In this case, it's easy to test
> though we'll need fixups in the device-tree to indicate the change in
> routing, or a quirk.
>
> The thing is, there -is- a cascaded 8259 in there,
But it's disabled, the HT APIC is used instead.
> and that's where the
> IRQ14 and IRQ15 end up in legacy mode (edge sensitive even) iirc,
> unless
> they are aslo routed to the APIC directly, but in anyway it's hidden by
> the firmware.
>
> So we can have a quirk in the Maple code to reconfigure that all in
> native mode.
It's probably best to trust the OF device tree, and only do
quirks if that turns out to be wrong. David says that's exactly
what his patch does, so... :-)
> Or keep the hook and use it in libata. It makes sense I think in
> general. I reckon other platforms might have good use of being able to
> "remap" those IRQs 14 and 15 from IDE controllers in legacy mode.
Yeah.
> I've
> seen plenty of cases where they are kept in that mode just to keep the
> IRQs non-shared.
Bad idea IMHO, but hey, can't fix the hardware in software ;-)
Segher
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 21:43 ` David Woodhouse
@ 2007-01-02 0:17 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-02 0:17 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik, Alan
On Mon, 2007-01-01 at 21:43 +0000, David Woodhouse wrote:
> On Mon, 2007-01-01 at 21:34 +0000, Alan wrote:
> > > Er, that would be pci_get_legacy_ide_irq(), which is what I _have_ used.
> >
> > Ok un-NAK that, I didn't realise there was a wrapper to those methods too.
> >
> > > As I said, the Maple board is the _only_ user, across all architectures
> > > and all PowerPC platforms, of pci_get_legacy_ide_irq(). And the AMD74xx
> >
> > The Motorola's also used to use funny IRQ numbers for IDE legacy - or are
> > they no longer supported
>
> Well, there's no other implementation of pci_get_legacy_ide_irq() (other
> than the default {15,14}) except for Maple, throughout all of arch/ppc
> and arch/powerpc.
Some other platforms may have hacked the drivers instead ... I added
pci_get_legacy_ide_irq() when doing Maple support but I didn't go back
to see if drivers had existing hacks that needed fixing to use it too.
In fact, some platforms in arch/ppc might even still use the old
deprecated trick of hooking the hwif init from IDE to setup the ports
addresses and irq.
> > > driver is the only driver which calls it -- for Maple. Hence the
> > > suggestion that perhaps there's a better way to do it.
> >
> > IRQ routing is platform not driver. Let's keep it that way.
>
> Well, yes -- that's what my patch does. I was just thinking that since
> this is the _only_ platform which currently uses it, it might be worth
> fixing it differently -- by changing the platform setup code to either
> route the interrupts to match what the generic code expects, or switch
> the controller to native mode.
>
> I'm happy enough with the patch I sent too though.
I prefer keeping this approach too. There have been cases in the past
where legacy IDE IRQs had to be remapped and I prefer having a clear
nice hook to do it properly. Even if there's only one user (in fact more
than one are there are more than one users of the maple platform :-) for
now, at least, it 'shows' the right way to do.
Ben.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
` (2 preceding siblings ...)
2007-01-01 21:22 ` Alan
@ 2007-01-02 0:18 ` Benjamin Herrenschmidt
2007-01-26 22:28 ` Jeff Garzik
4 siblings, 0 replies; 16+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-02 0:18 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, jgarzik, alan
On Mon, 2007-01-01 at 19:31 +0000, David Woodhouse wrote:
> On the Maple board, the AMD8111 IDE is in legacy mode... except that it
> appears on IRQ 20 instead of IRQ 15. For drivers/ide this was handled by
> the architecture's "pci_get_legacy_ide_irq()" function, but in libata we
> just hard-code the numbers 14 and 15.
>
> This patch provides asm-powerpc/libata-portmap.h which maps the IRQ as
> appropriate, having added a pci_dev argument to the
> ATA_{PRIM,SECOND}ARY_IRQ macros.
>
> There's probably a better way to do this -- especially if we observe
> that the _only_ case in which this seemingly-generic
> "pci_get_legacy_ide_irq()" function returns anything other than 14 and
> 15 for primary and secondary respectively is the case of the AMD8111 on
> the Maple board -- couldn't we handle that with a special case in the
> pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
> native mode during early boot and assign resources properly?
>
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 0673dbe..1857707 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -484,6 +484,7 @@ config PPC_MAPLE
> select PPC_970_NAP
> select PPC_NATIVE
> select PPC_RTAS
> + select ATA_NONSTANDARD if ATA
> default n
> help
> This option enables support for the Maple 970FX Evaluation Board.
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 7645f2b..bf44f6d 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -879,7 +879,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
> probe_ent->n_ports = 2;
>
> if (port_mask & ATA_PORT_PRIMARY) {
> - probe_ent->irq = ATA_PRIMARY_IRQ;
> + probe_ent->irq = ATA_PRIMARY_IRQ(pdev);
> probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
> probe_ent->port[0].altstatus_addr =
> probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
> @@ -894,9 +894,9 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
>
> if (port_mask & ATA_PORT_SECONDARY) {
> if (probe_ent->irq)
> - probe_ent->irq2 = ATA_SECONDARY_IRQ;
> + probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev);
> else
> - probe_ent->irq = ATA_SECONDARY_IRQ;
> + probe_ent->irq = ATA_SECONDARY_IRQ(pdev);
> probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
> probe_ent->port[1].altstatus_addr =
> probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
> diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
> index 9202fd0..ec742ca 100644
> --- a/include/asm-generic/libata-portmap.h
> +++ b/include/asm-generic/libata-portmap.h
> @@ -1,12 +1,12 @@
> #ifndef __ASM_GENERIC_LIBATA_PORTMAP_H
> #define __ASM_GENERIC_LIBATA_PORTMAP_H
>
> #define ATA_PRIMARY_CMD 0x1F0
> #define ATA_PRIMARY_CTL 0x3F6
> -#define ATA_PRIMARY_IRQ 14
> +#define ATA_PRIMARY_IRQ(dev) 14
>
> #define ATA_SECONDARY_CMD 0x170
> #define ATA_SECONDARY_CTL 0x376
> -#define ATA_SECONDARY_IRQ 15
> +#define ATA_SECONDARY_IRQ(dev) 15
>
> #endif
> --- /dev/null 2006-12-19 10:44:19.206057770 +0000
> +++ b/include/asm-powerpc/libata-portmap.h 2006-12-31 00:32:04.000000000 +0000
> @@ -0,0 +1,12 @@
> +#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
> +#define __ASM_POWERPC_LIBATA_PORTMAP_H
> +
> +#define ATA_PRIMARY_CMD 0x1F0
> +#define ATA_PRIMARY_CTL 0x3F6
> +#define ATA_PRIMARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 0)
> +
> +#define ATA_SECONDARY_CMD 0x170
> +#define ATA_SECONDARY_CTL 0x376
> +#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
> +
> +#endif
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 03f6338..6a38c9b 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -19,6 +19,10 @@ config ATA
>
> if ATA
>
> +config ATA_NONSTANDARD
> + bool
> + default n
> +
> config SATA_AHCI
> tristate "AHCI SATA support"
> depends on PCI
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Fix Maple PATA IRQ assignment.
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
` (3 preceding siblings ...)
2007-01-02 0:18 ` Benjamin Herrenschmidt
@ 2007-01-26 22:28 ` Jeff Garzik
4 siblings, 0 replies; 16+ messages in thread
From: Jeff Garzik @ 2007-01-26 22:28 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, alan
David Woodhouse wrote:
> On the Maple board, the AMD8111 IDE is in legacy mode... except that it
> appears on IRQ 20 instead of IRQ 15. For drivers/ide this was handled by
> the architecture's "pci_get_legacy_ide_irq()" function, but in libata we
> just hard-code the numbers 14 and 15.
>
> This patch provides asm-powerpc/libata-portmap.h which maps the IRQ as
> appropriate, having added a pci_dev argument to the
> ATA_{PRIM,SECOND}ARY_IRQ macros.
>
> There's probably a better way to do this -- especially if we observe
> that the _only_ case in which this seemingly-generic
> "pci_get_legacy_ide_irq()" function returns anything other than 14 and
> 15 for primary and secondary respectively is the case of the AMD8111 on
> the Maple board -- couldn't we handle that with a special case in the
> pata_amd driver, or perhaps with a PCI quirk for Maple to switch it into
> native mode during early boot and assign resources properly?
>
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
applied
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-01-26 22:28 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-01 19:31 [PATCH] Fix Maple PATA IRQ assignment David Woodhouse
2007-01-01 20:10 ` Benjamin Herrenschmidt
2007-01-01 20:26 ` David Woodhouse
2007-01-01 21:23 ` Benjamin Herrenschmidt
2007-01-01 20:44 ` Segher Boessenkool
2007-01-01 21:33 ` Benjamin Herrenschmidt
2007-01-01 22:17 ` Segher Boessenkool
2007-01-01 20:42 ` Segher Boessenkool
2007-01-01 20:56 ` David Woodhouse
2007-01-01 21:22 ` Alan
2007-01-01 21:15 ` David Woodhouse
2007-01-01 21:34 ` Alan
2007-01-01 21:43 ` David Woodhouse
2007-01-02 0:17 ` Benjamin Herrenschmidt
2007-01-02 0:18 ` Benjamin Herrenschmidt
2007-01-26 22:28 ` Jeff Garzik
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).