Re: [PARPORT] ECR setting problem solved, sort of.


Tim Waugh (twaugh@redhat.com)
Wed, 16 Feb 2000 11:51:56 +0000 (GMT)


On Tue, 15 Feb 2000, Eugene Weiss wrote:

> after bootup with parport in the kernel: 0x35

Right. PS/2 mode, no ERR interrupt, no service, FIFO empty. That's from
the end of parport_pc_probe_port.

> after lp is invoked as above, or after bootup with parport and parport_pc as
> modules: 0x05;

Huh? Suddenly we're in SPP mode, and ERR interrupts are enabled. But lp
doesn't mess with the ECR!

I've attached a patch that avoids SPP mode during probing (it's just like
PS2 mode except that input mode doesn't work properly), but I don't see
how that can change what you're seeing.

Are you using hardware assistance (CONFIG_PARPORT_FIFO)? Try disabling
that and see what happens.

> It does:
>
> if (mode >= 2 && m >= 2) {
> /* We have to go through mode 001 */
> oecr &= ~(7 << 5);
> oecr |= ECR_PS2 << 5;
> outb (oecr, ecr);
> }

That's not the only place that writes to ECR, and there are more rules
than that. NatSemi's rules are:

[...]

2. When ECP is enabled, and the software wishes to switch modes, it should
switch only through modes 000 or 001.

3. When ECP is enabled, the software should change direction only in mode
001.

4. The software should switch from mode 010 or 011, to mdoe 000 or 001,
only when the FIFO is empty.

5. The software should switch to mode 011 when bits 0 and 1 of DCR are 0.

6. The software should switch to mode 010 when bit 0 of DCR is 0.

[...]

(DCR is what the CTR becomes when in ECP mode.)

I _know_ we break some of those rules, and sometimes it's unavoidable.

Tim.
*/

Index: drivers/parport/parport_pc.c
===================================================================
RCS file: /usr/local/src/cvsroot/linux/drivers/parport/parport_pc.c,v
retrieving revision 1.24
diff -d -u -p -r1.24 parport_pc.c
--- drivers/parport/parport_pc.c 2000/02/04 09:24:57 1.24
+++ drivers/parport/parport_pc.c 2000/02/16 11:45:35
@@ -1089,8 +1089,8 @@ static int __maybe_init parport_ECR_pres
         priv->ecr = 1;
         outb (0xc, CONTROL (pb));
         
- /* Go to mode 000 */
- frob_econtrol (pb, 0xe0, ECR_SPP << 5);
+ /* Go to mode 001 */
+ frob_econtrol (pb, 0xe0, ECR_PS2 << 5);
 
         return 1;
 
@@ -1167,7 +1167,7 @@ static int __maybe_init parport_ECP_supp
          * it doesn't support ECP or FIFO MODE
          */
         if (i == 1024) {
- outb (ECR_SPP << 5, ECONTROL (pb));
+ outb (ECR_PS2 << 5, ECONTROL (pb));
                 return 0;
         }
 
@@ -1249,8 +1249,8 @@ static int __maybe_init parport_ECP_supp
                 pb->irq = PARPORT_IRQ_NONE;
         }
 
- /* Go back to mode 000 */
- frob_econtrol (pb, 0xe0, ECR_SPP << 5);
+ /* Go back to mode 001 */
+ frob_econtrol (pb, 0xe0, ECR_PS2 << 5);
         pb->modes |= PARPORT_MODE_ECP;
 
         return 1;
@@ -1395,7 +1395,7 @@ static int __maybe_init irq_probe_ECP(st
                 outb (0xaa, FIFO (pb));
                 
         pb->irq = probe_irq_off(irqs);
- outb (ECR_SPP << 5, ECONTROL (pb));
+ outb (ECR_PS2 << 5, ECONTROL (pb));
 
         if (pb->irq <= 0)
                 pb->irq = PARPORT_IRQ_NONE;

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Wed 16 Feb 2000 - 06:52:59 EST