2003-01-11 16:25:07

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: [PATCH] sl82c105 driver update

Enclosed is an update to the sl82c105 driver against 2.4.21-pre3, I'll
produce a 2.5 version once this is accepted by Alan.

It adds a pio_speed field to the generic IDE struct drive. This field is
currently only used by this driver, not by the core, and stores the last
used PIO speed for use when disabling DMA.

This patch fix the current oops caused by this driver on boot, along
with other fixes & HW bugs workarounds by Russel King and me.

Alan, please send to Marcelo if you are ok. Currently tested on a briQ
HW (one channel, one master disk).

Note that I intentionally stop force-enabling the second channel (the
old driver did that) since this cause problems on machines with only one
channel wired and no pull down resistor on D7. It's the responsibility
of the BIOS or arch fixup of machines with 2 channels to properly set
the enable bits for the second one. The first one is always assumed
enabled for now (though I have nothing against changing that too).

--
Benjamin Herrenschmidt <[email protected]>


Attachments:
winbond.diff (12.49 kB)

2003-01-11 19:38:07

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

Then add this one on top of it ;)

Ben.


--- 1.7/drivers/ide/pci/sl82c105.c Sat Jan 11 17:24:47 2003
+++ edited/drivers/ide/pci/sl82c105.c Sat Jan 11 20:44:51 2003
@@ -470,7 +470,7 @@
*/
hwif->drives[0].pio_speed = XFER_PIO_0;
hwif->drives[0].autotune = 1;
- hwif->drives[1].pio_speed = XFER_PIO_1;
+ hwif->drives[1].pio_speed = XFER_PIO_0;
hwif->drives[1].autotune = 1;

pci_read_config_dword(dev, 0x40, &val);

2003-01-11 22:23:48

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

On Sat, Jan 11, 2003 at 05:33:19PM +0100, Benjamin Herrenschmidt wrote:
> Enclosed is an update to the sl82c105 driver against 2.4.21-pre3, I'll
> produce a 2.5 version once this is accepted by Alan.

Its still broken - if it uses DMA, the ide core will call ide_dma_on,
which will call config_for_dma(), which will call ide_config_drive_speed,
which will then call ide_dma_on, etc.

Sorry, I don't have a solution off hand for this. I just wish that
the IDE core didn't change in these incompatible ways during a stable
kernel release.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-01-11 22:35:12

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

On Sat, 2003-01-11 at 23:32, Russell King wrote:
> On Sat, Jan 11, 2003 at 05:33:19PM +0100, Benjamin Herrenschmidt wrote:
> > Enclosed is an update to the sl82c105 driver against 2.4.21-pre3, I'll
> > produce a 2.5 version once this is accepted by Alan.
>
> Its still broken - if it uses DMA, the ide core will call ide_dma_on,
> which will call config_for_dma(), which will call ide_config_drive_speed,
> which will then call ide_dma_on, etc.
>
> Sorry, I don't have a solution off hand for this. I just wish that
> the IDE core didn't change in these incompatible ways during a stable
> kernel release.

No this problem is not here, at least not in 2.4, I did test it ;)

ide_config_drive_speed will call ide_dma_host_on, not ide_dma_on.

Note that I think sl82c105 and ide-pmac are the only ones to redo the
DMA config on ide_dma_on. Most chipsets only do it on ide_dma_check, but
I chosed to do it in ide_dma_on too mostly because I found no way to
re-trigger ide_dma_check from hdparm (well, this might have changed
since, I have to dbl check).

Ben.

2003-01-11 22:40:00

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

On Sat, Jan 11, 2003 at 11:44:15PM +0100, Benjamin Herrenschmidt wrote:

> On Sat, 2003-01-11 at 23:32, Russell King wrote:
> > On Sat, Jan 11, 2003 at 05:33:19PM +0100, Benjamin Herrenschmidt wrote:
> > > Enclosed is an update to the sl82c105 driver against 2.4.21-pre3, I'll
> > > produce a 2.5 version once this is accepted by Alan.
> >
> > Its still broken - if it uses DMA, the ide core will call ide_dma_on,
> > which will call config_for_dma(), which will call ide_config_drive_speed,
> > which will then call ide_dma_on, etc.
> >
> > Sorry, I don't have a solution off hand for this. I just wish that
> > the IDE core didn't change in these incompatible ways during a stable
> > kernel release.
>
> No this problem is not here, at least not in 2.4, I did test it ;)
>
> ide_config_drive_speed will call ide_dma_host_on, not ide_dma_on.
>
> Note that I think sl82c105 and ide-pmac are the only ones to redo the
> DMA config on ide_dma_on. Most chipsets only do it on ide_dma_check, but
> I chosed to do it in ide_dma_on too mostly because I found no way to
> re-trigger ide_dma_check from hdparm (well, this might have changed
> since, I have to dbl check).

Correct, and it seems that if you have automatic DMA disabled in the
kernel and then use hdparm -d1, this leads to a lot of trouble.

--
Vojtech Pavlik
SuSE Labs

2003-01-11 23:01:53

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

On Sat, 2003-01-11 at 23:48, Vojtech Pavlik wrote:

> > Note that I think sl82c105 and ide-pmac are the only ones to redo the
> > DMA config on ide_dma_on. Most chipsets only do it on ide_dma_check, but
> > I chosed to do it in ide_dma_on too mostly because I found no way to
> > re-trigger ide_dma_check from hdparm (well, this might have changed
> > since, I have to dbl check).
>
> Correct, and it seems that if you have automatic DMA disabled in the
> kernel and then use hdparm -d1, this leads to a lot of trouble.

Which is why I did that in the first place on pmac, so that hdparm -d1
gave proper timings in the first place (my firmware does nothing useful
and I hard reset the drives & controller on boot anyway).


--
Benjamin Herrenschmidt <[email protected]>

2003-01-12 01:46:16

by Kurt Garloff

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

Hi Vojtech,

On Sat, Jan 11, 2003 at 11:48:19PM +0100, Vojtech Pavlik wrote:
> Correct, and it seems that if you have automatic DMA disabled in the
> kernel and then use hdparm -d1, this leads to a lot of trouble.

Ack, that's the problem I reported to you the other day, if I'm not mistaken.
-d1 -Xwhatever worked, just -d1 not.

Regards,
--
Kurt Garloff <[email protected]> Eindhoven, NL
GPG key: See mail header, key servers SuSE Labs
SuSE Linux AG, Nuernberg, DE SCSI, Security


Attachments:
(No filename) (557.00 B)
(No filename) (189.00 B)
Download all attachments

2003-01-12 08:58:37

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] sl82c105 driver update

On Sun, Jan 12, 2003 at 02:54:56AM +0100, Kurt Garloff wrote:

> On Sat, Jan 11, 2003 at 11:48:19PM +0100, Vojtech Pavlik wrote:
> > Correct, and it seems that if you have automatic DMA disabled in the
> > kernel and then use hdparm -d1, this leads to a lot of trouble.
>
> Ack, that's the problem I reported to you the other day, if I'm not mistaken.
> -d1 -Xwhatever worked, just -d1 not.

Yes, that's it. And after some investigation I did it seems like it's so
by design - without using -Xwhatever the IDE driver 'just enables' DMA,
using the BIOS settings of harddrive and the chipset. At least it is so
in recent 2.4's.

I'll have to ask Alan and Andre what really is the intention.

--
Vojtech Pavlik
SuSE Labs