linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IDE on CHRP LongTrail
@ 2002-12-23 22:13 Geert Uytterhoeven
  2002-12-24  7:40 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2002-12-23 22:13 UTC (permalink / raw)
  To: Linux/PPC Development


This patch enables the SL82C105 IDE interface in the W83C553 PCI/ISA bridge on
my CHRP LongTrail.

There are 2 ways to configure the IDE interface:
  - Legacy mode, using IRQ 14 for the primary channel, and IRQ 15 for the
    secondary channel
  - Native mode, using IRQ 32 (OpenPIC IRQ 16) for both channels

Apparently Open Firmware left the IDE interface in legacy mode, while the
interrupt property of the device pointed to the OpenPIC interrupt. Of course
this mix of legacy and native mode didn't work well and no interrupts came
through.

With the patch below, the SL82C105 is configured for native mode and both IDE
channels work. The patch applies to 2.4.21-pre2 as well, but there IDE seems to
be broken on PPC in general.

--- linux-ppc-2.4.20/arch/ppc/platforms/chrp_pci.c.orig	Sun Dec 22 15:52:13 2002
+++ linux-ppc-2.4.20/arch/ppc/platforms/chrp_pci.c	Mon Dec 23 20:37:10 2002
@@ -194,6 +194,44 @@
 	}
 }

+
+/* W83C553 IDE Interrupt Routing Control Register */
+#define W83C553_IDEIRCR		0x43
+
+/* SL82C105 IDE Control/Status Register */
+#define SL82C105_IDECSR		0x41
+
+static void __init
+longtrail_pcibios_fixup(void)
+{
+	struct pci_dev *w83c553, *sl82c105;
+	u8 progif;
+
+	chrp_pcibios_fixup();
+
+	/*
+	 *  Open Firmware may have left the SL82C105 IDE interface in the
+	 *  W83C553 PCI/ISA bridge in legacy mode
+	 */
+	if ((w83c553 = pci_find_device(PCI_VENDOR_ID_WINBOND,
+				       PCI_DEVICE_ID_WINBOND_83C553, 0)) &&
+	    (sl82c105 = pci_find_device(PCI_VENDOR_ID_WINBOND,
+					PCI_DEVICE_ID_WINBOND_82C105,
+					w83c553)) &&
+	    (sl82c105->class & 5) != 5) {
+		printk("W83C553: Switching SL82C105 IDE to PCI native mode\n");
+		/* Enable W83C553 legacy interrupt internal routing to INTC#, */
+		/* which is connected to HYDRA_INT_EXT5 */
+		pci_write_config_byte(w83c553, W83C553_IDEIRCR, 0x00);
+		/* Enable SL82C105 PCI native IDE mode */
+		pci_read_config_byte(sl82c105, PCI_CLASS_PROG, &progif);
+		pci_write_config_byte(sl82c105, PCI_CLASS_PROG, progif | 0x05);
+		sl82c105->class |= 0x05;
+		/* Enable SL82C105 legacy interrupts */
+		pci_write_config_byte(sl82c105, SL82C105_IDECSR, 0x08);
+	}
+}
+
 #define PRG_CL_RESET_VALID 0x00010000

 static void __init
@@ -318,5 +356,8 @@
 		}
 	}

-	ppc_md.pcibios_fixup = chrp_pcibios_fixup;
+	if (is_longtrail)
+		ppc_md.pcibios_fixup = longtrail_pcibios_fixup;
+	else
+		ppc_md.pcibios_fixup = chrp_pcibios_fixup;
 }

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-23 22:13 [PATCH] IDE on CHRP LongTrail Geert Uytterhoeven
@ 2002-12-24  7:40 ` Benjamin Herrenschmidt
  2002-12-24  9:09   ` Geert Uytterhoeven
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2002-12-24  7:40 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/PPC Development


On Mon, 2002-12-23 at 23:13, Geert Uytterhoeven wrote:
>
> This patch enables the SL82C105 IDE interface in the W83C553 PCI/ISA bridge on
> my CHRP LongTrail.
>
> There are 2 ways to configure the IDE interface:
>   - Legacy mode, using IRQ 14 for the primary channel, and IRQ 15 for the
>     secondary channel
>   - Native mode, using IRQ 32 (OpenPIC IRQ 16) for both channels
>
> Apparently Open Firmware left the IDE interface in legacy mode, while the
> interrupt property of the device pointed to the OpenPIC interrupt. Of course
> this mix of legacy and native mode didn't work well and no interrupts came
> through.
>
> With the patch below, the SL82C105 is configured for native mode and both IDE
> channels work. The patch applies to 2.4.21-pre2 as well, but there IDE seems to
> be broken on PPC in general.

I'd rather use a pci quirk here... also, why not make this generic to
all PPCs with a W83c553 ? I know the briQ at least will need something
similar.

Regarding 2.4.21-pre2, did you check the linuxppc_2_4 tree ?

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-24  7:40 ` Benjamin Herrenschmidt
@ 2002-12-24  9:09   ` Geert Uytterhoeven
  2002-12-24  9:52     ` Geert Uytterhoeven
  2002-12-26 13:18     ` Geert Uytterhoeven
  0 siblings, 2 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2002-12-24  9:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linux/PPC Development


On 24 Dec 2002, Benjamin Herrenschmidt wrote:
> On Mon, 2002-12-23 at 23:13, Geert Uytterhoeven wrote:
> > This patch enables the SL82C105 IDE interface in the W83C553 PCI/ISA bridge on
> > my CHRP LongTrail.
> >
> > There are 2 ways to configure the IDE interface:
> >   - Legacy mode, using IRQ 14 for the primary channel, and IRQ 15 for the
> >     secondary channel
> >   - Native mode, using IRQ 32 (OpenPIC IRQ 16) for both channels
> >
> > Apparently Open Firmware left the IDE interface in legacy mode, while the
> > interrupt property of the device pointed to the OpenPIC interrupt. Of course
> > this mix of legacy and native mode didn't work well and no interrupts came
> > through.
> >
> > With the patch below, the SL82C105 is configured for native mode and both IDE
> > channels work. The patch applies to 2.4.21-pre2 as well, but there IDE seems to
> > be broken on PPC in general.
>
> I'd rather use a pci quirk here... also, why not make this generic to
> all PPCs with a W83c553 ? I know the briQ at least will need something
> similar.

I did not want to touch non-LongTrail code.

How is the interrupt routing done on the BriQ? On the LongTrail both legacy
mode (ISA IRQ 14/15) and PCI native mode (PCI IRQ connected to OpenPIC) are
possible for IDE.

> Regarding 2.4.21-pre2, did you check the linuxppc_2_4 tree ?

Yes, I checked it during the weekend. Crash in IDE access operations.
I wrote down the addresses and the corresponding routine names. If you want
them, I can mail them (when I get back to the piece of paper).

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-24  9:09   ` Geert Uytterhoeven
@ 2002-12-24  9:52     ` Geert Uytterhoeven
  2002-12-24 10:00       ` Benjamin Herrenschmidt
  2002-12-26 13:18     ` Geert Uytterhoeven
  1 sibling, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2002-12-24  9:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linux/PPC Development


On Tue, 24 Dec 2002, Geert Uytterhoeven wrote:
> On 24 Dec 2002, Benjamin Herrenschmidt wrote:
> > Regarding 2.4.21-pre2, did you check the linuxppc_2_4 tree ?
>
> Yes, I checked it during the weekend. Crash in IDE access operations.
> I wrote down the addresses and the corresponding routine names. If you want
> them, I can mail them (when I get back to the piece of paper).

Thanks to my wife, here's the list:

NIP C00A5908 ide_inb
CR  C00A70F8 ide_config_drive_speed
BT  C00A6F54 ide_config_drive_speed
    C00A3314 config_for_pio
    C00A356C sl82c105_ide_dma_off

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-24  9:52     ` Geert Uytterhoeven
@ 2002-12-24 10:00       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2002-12-24 10:00 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/PPC Development


On Tue, 2002-12-24 at 10:52, Geert Uytterhoeven wrote:
> On Tue, 24 Dec 2002, Geert Uytterhoeven wrote:
> > On 24 Dec 2002, Benjamin Herrenschmidt wrote:
> > > Regarding 2.4.21-pre2, did you check the linuxppc_2_4 tree ?
> >
> > Yes, I checked it during the weekend. Crash in IDE access operations.
> > I wrote down the addresses and the corresponding routine names. If you want
> > them, I can mail them (when I get back to the piece of paper).
>
> Thanks to my wife, here's the list:
>
> NIP C00A5908 ide_inb
> CR  C00A70F8 ide_config_drive_speed
> BT  C00A6F54 ide_config_drive_speed
>     C00A3314 config_for_pio
>     C00A356C sl82c105_ide_dma_off

Ok, I'll look at this when I'm back (I have no pci-ide HW at hand, and
ide-pmac works as it uses different MMIO access ops now).

Regarding briq and winbond, same answer, I need to check it out when I'm
back from vacation, I'm not yet sure about what OF does here, but I
surely want to switch it to fully native mode as well, especially since
the kernel will soon (I think 2.5 is already that way) ignore the BARs
completely when using legacy mode.

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-24  9:09   ` Geert Uytterhoeven
  2002-12-24  9:52     ` Geert Uytterhoeven
@ 2002-12-26 13:18     ` Geert Uytterhoeven
  2002-12-26 16:17       ` Gabriel Paubert
  1 sibling, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2002-12-26 13:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Gabriel Paubert; +Cc: Linux/PPC Development


On Tue, 24 Dec 2002, Geert Uytterhoeven wrote:
> On 24 Dec 2002, Benjamin Herrenschmidt wrote:
> > On Mon, 2002-12-23 at 23:13, Geert Uytterhoeven wrote:
> > > This patch enables the SL82C105 IDE interface in the W83C553 PCI/ISA bridge on
> > > my CHRP LongTrail.
> > >
> > > There are 2 ways to configure the IDE interface:
> > >   - Legacy mode, using IRQ 14 for the primary channel, and IRQ 15 for the
> > >     secondary channel
> > >   - Native mode, using IRQ 32 (OpenPIC IRQ 16) for both channels
> > >
> > > Apparently Open Firmware left the IDE interface in legacy mode, while the
> > > interrupt property of the device pointed to the OpenPIC interrupt. Of course
> > > this mix of legacy and native mode didn't work well and no interrupts came
> > > through.
> > >
> > > With the patch below, the SL82C105 is configured for native mode and both IDE
> > > channels work. The patch applies to 2.4.21-pre2 as well, but there IDE seems to
> > > be broken on PPC in general.
> >
> > I'd rather use a pci quirk here... also, why not make this generic to
> > all PPCs with a W83c553 ? I know the briQ at least will need something
> > similar.
>
> I did not want to touch non-LongTrail code.
>
> How is the interrupt routing done on the BriQ? On the LongTrail both legacy
> mode (ISA IRQ 14/15) and PCI native mode (PCI IRQ connected to OpenPIC) are
> possible for IDE.

Anyone with a BriQ (and preferably working IDE) who can tell us the output of
`lspci -v' and of `cat /proc/interrupts'?

There are other boards with a W83C553 out there. Gabriel?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] IDE on CHRP LongTrail
  2002-12-26 13:18     ` Geert Uytterhoeven
@ 2002-12-26 16:17       ` Gabriel Paubert
  0 siblings, 0 replies; 7+ messages in thread
From: Gabriel Paubert @ 2002-12-26 16:17 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Benjamin Herrenschmidt, Linux/PPC Development


Geert Uytterhoeven wrote:
> On Tue, 24 Dec 2002, Geert Uytterhoeven wrote:
>
>>On 24 Dec 2002, Benjamin Herrenschmidt wrote:
>>
>>>On Mon, 2002-12-23 at 23:13, Geert Uytterhoeven wrote:
>>>
>>>>This patch enables the SL82C105 IDE interface in the W83C553 PCI/ISA bridge on
>>>>my CHRP LongTrail.
>>>>
>>>>There are 2 ways to configure the IDE interface:
>>>>  - Legacy mode, using IRQ 14 for the primary channel, and IRQ 15 for the
>>>>    secondary channel
>>>>  - Native mode, using IRQ 32 (OpenPIC IRQ 16) for both channels
>>>>
>>>>Apparently Open Firmware left the IDE interface in legacy mode, while the
>>>>interrupt property of the device pointed to the OpenPIC interrupt. Of course
>>>>this mix of legacy and native mode didn't work well and no interrupts came
>>>>through.
>>>>
>>>>With the patch below, the SL82C105 is configured for native mode and both IDE
>>>>channels work. The patch applies to 2.4.21-pre2 as well, but there IDE seems to
>>>>be broken on PPC in general.
>>>
>>>I'd rather use a pci quirk here... also, why not make this generic to
>>>all PPCs with a W83c553 ? I know the briQ at least will need something
>>>similar.
>>
>>I did not want to touch non-LongTrail code.
>>
>>How is the interrupt routing done on the BriQ? On the LongTrail both legacy
>>mode (ISA IRQ 14/15) and PCI native mode (PCI IRQ connected to OpenPIC) are
>>possible for IDE.
>
>
> Anyone with a BriQ (and preferably working IDE) who can tell us the output of
> `lspci -v' and of `cat /proc/interrupts'?
>
> There are other boards with a W83C553 out there. Gabriel?

There are no IDE connectors on the MVME boards I have, so the W83C553/554
is there but the IDE part is not accessible, unless you are courageous
enough to solder wires directly on the pins of the chip ;-)

	Gabriel.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-12-26 16:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-23 22:13 [PATCH] IDE on CHRP LongTrail Geert Uytterhoeven
2002-12-24  7:40 ` Benjamin Herrenschmidt
2002-12-24  9:09   ` Geert Uytterhoeven
2002-12-24  9:52     ` Geert Uytterhoeven
2002-12-24 10:00       ` Benjamin Herrenschmidt
2002-12-26 13:18     ` Geert Uytterhoeven
2002-12-26 16:17       ` Gabriel Paubert

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).