2010-07-31 20:55:41

by Ondrej Zary

[permalink] [raw]
Subject: [PATCH 1/3] cyber2000fb: fix machine hang on module load

I was testing two CyberPro 2000 based PCI cards on x86 and the machine always
hanged completely when the cyber2000fb module was loaded. It seems that the
card hangs when some registers are accessed too quickly after writing RAMDAC
control register. With this patch, both card work.

Add delay after RAMDAC control register write to prevent hangs on module load.

Signed-off-by: Ondrej Zary <[email protected]>

--- linux-2.6.35-rc2-orig/drivers/video/cyber2000fb.c 2010-06-06 05:43:24.000000000 +0200
+++ linux-2.6.35-rc3/drivers/video/cyber2000fb.c 2010-07-27 23:12:37.000000000 +0200
@@ -436,6 +436,8 @@ static void cyber2000fb_write_ramdac_ctr
cyber2000fb_writeb(i | 4, 0x3cf, cfb);
cyber2000fb_writeb(val, 0x3c6, cfb);
cyber2000fb_writeb(i, 0x3cf, cfb);
+ /* prevent card lock-up observed on x86 with CyberPro 2000 */
+ cyber2000fb_readb(0x3cf, cfb);
}

static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)



--
Ondrej Zary


2010-07-31 21:21:40

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 1/3] cyber2000fb: fix machine hang on module load

On 07/31/2010 04:55 PM, Ondrej Zary wrote:
> I was testing two CyberPro 2000 based PCI cards on x86 and the machine always
> hanged completely when the cyber2000fb module was loaded. It seems that the
> card hangs when some registers are accessed too quickly after writing RAMDAC
> control register. With this patch, both card work.
>
> Add delay after RAMDAC control register write to prevent hangs on module load.
>
> Signed-off-by: Ondrej Zary<[email protected]>
>
> --- linux-2.6.35-rc2-orig/drivers/video/cyber2000fb.c 2010-06-06 05:43:24.000000000 +0200
> +++ linux-2.6.35-rc3/drivers/video/cyber2000fb.c 2010-07-27 23:12:37.000000000 +0200
> @@ -436,6 +436,8 @@ static void cyber2000fb_write_ramdac_ctr
> cyber2000fb_writeb(i | 4, 0x3cf, cfb);
> cyber2000fb_writeb(val, 0x3c6, cfb);
> cyber2000fb_writeb(i, 0x3cf, cfb);
> + /* prevent card lock-up observed on x86 with CyberPro 2000 */
> + cyber2000fb_readb(0x3cf, cfb);
> }

IIRC, cyber2000 is basically an S3 graphics chip. When working on s3fb,
over a decade ago, ISTR needing a lot of MMIO register flushes -- dummy
register reads -- to flush out just-written register writes.

2010-07-31 21:25:32

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 1/3] cyber2000fb: fix machine hang on module load

On Sat, Jul 31, 2010 at 05:21:33PM -0400, Jeff Garzik wrote:
> On 07/31/2010 04:55 PM, Ondrej Zary wrote:
>> I was testing two CyberPro 2000 based PCI cards on x86 and the machine always
>> hanged completely when the cyber2000fb module was loaded. It seems that the
>> card hangs when some registers are accessed too quickly after writing RAMDAC
>> control register. With this patch, both card work.
>>
>> Add delay after RAMDAC control register write to prevent hangs on module load.
>>
>> Signed-off-by: Ondrej Zary<[email protected]>
>>
>> --- linux-2.6.35-rc2-orig/drivers/video/cyber2000fb.c 2010-06-06 05:43:24.000000000 +0200
>> +++ linux-2.6.35-rc3/drivers/video/cyber2000fb.c 2010-07-27 23:12:37.000000000 +0200
>> @@ -436,6 +436,8 @@ static void cyber2000fb_write_ramdac_ctr
>> cyber2000fb_writeb(i | 4, 0x3cf, cfb);
>> cyber2000fb_writeb(val, 0x3c6, cfb);
>> cyber2000fb_writeb(i, 0x3cf, cfb);
>> + /* prevent card lock-up observed on x86 with CyberPro 2000 */
>> + cyber2000fb_readb(0x3cf, cfb);
>> }
>
> IIRC, cyber2000 is basically an S3 graphics chip.

No such luck. It's a proprietary Integraphics chip, mainly used in
ARM Netwinders some 10 years ago. It's completely different from the
S3 chips such as Trio64.

2010-07-31 22:37:32

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 1/3] cyber2000fb: fix machine hang on module load

On 07/31/2010 05:25 PM, Russell King - ARM Linux wrote:
> On Sat, Jul 31, 2010 at 05:21:33PM -0400, Jeff Garzik wrote:
>> On 07/31/2010 04:55 PM, Ondrej Zary wrote:
>>> I was testing two CyberPro 2000 based PCI cards on x86 and the machine always
>>> hanged completely when the cyber2000fb module was loaded. It seems that the
>>> card hangs when some registers are accessed too quickly after writing RAMDAC
>>> control register. With this patch, both card work.
>>>
>>> Add delay after RAMDAC control register write to prevent hangs on module load.
>>>
>>> Signed-off-by: Ondrej Zary<[email protected]>
>>>
>>> --- linux-2.6.35-rc2-orig/drivers/video/cyber2000fb.c 2010-06-06 05:43:24.000000000 +0200
>>> +++ linux-2.6.35-rc3/drivers/video/cyber2000fb.c 2010-07-27 23:12:37.000000000 +0200
>>> @@ -436,6 +436,8 @@ static void cyber2000fb_write_ramdac_ctr
>>> cyber2000fb_writeb(i | 4, 0x3cf, cfb);
>>> cyber2000fb_writeb(val, 0x3c6, cfb);
>>> cyber2000fb_writeb(i, 0x3cf, cfb);
>>> + /* prevent card lock-up observed on x86 with CyberPro 2000 */
>>> + cyber2000fb_readb(0x3cf, cfb);
>>> }
>>
>> IIRC, cyber2000 is basically an S3 graphics chip.
>
> No such luck. It's a proprietary Integraphics chip, mainly used in
> ARM Netwinders some 10 years ago. It's completely different from the
> S3 chips such as Trio64.

Ah, I stand corrected. Maybe that was cyberfb I was remembering...

Jeff


2010-07-31 22:51:56

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 1/3] cyber2000fb: fix machine hang on module load

On Sat, Jul 31, 2010 at 06:37:27PM -0400, Jeff Garzik wrote:
> On 07/31/2010 05:25 PM, Russell King - ARM Linux wrote:
>> No such luck. It's a proprietary Integraphics chip, mainly used in
>> ARM Netwinders some 10 years ago. It's completely different from the
>> S3 chips such as Trio64.
>
> Ah, I stand corrected. Maybe that was cyberfb I was remembering...

I think so - the old cyberfb.h contained this:
-/* s3 commands */
-#define S3_BITBLT 0xc011
-#define S3_TWOPOINTLINE 0x2811
-#define S3_FILLEDRECT 0x40b1

so yes, it was similar to the S3 driver.