Bug 9306

Summary: LPC IT8705 POST port making noise on parallel port
Product: Drivers Reporter: Petr Cvek (petr.cvek)
Component: ParallelAssignee: Alan (alan)
Status: CLOSED CODE_FIX    
Severity: normal CC: protasnb
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: tested on 2.0.33, 2.4.29, 2.6.16, probably all versions Subsystem:
Regression: --- Bisected commit-id:
Attachments: Test patch
Working patch

Description Petr Cvek 2007-11-04 08:58:15 UTC
Hardware Environment: LPC chip ITE IT8705, mainboard ECS K7S5A, SIS735
Problem Description: 
Low pin controller IT8705 has special function, which sends data from POST port 0x80 (default) to pins of parallel port. This function is default enabled, but BIOS disables it before boot. While booting, kernel probably resets this chip again and doesn't disable POST function. Then all programs, that have outb delay send data to parallel port and make noise on it. This makes PLIP connection works very bad with this chip, but doesn't affect printing (probably beacause printer using handshake wires).


Reference: datasheet page 63 and 64 http://www.alldatasheet.com/datasheet-pdf/pdf/117633/ETC/IT8705F.html


Very simple (and I don't know how it's correct) C source below makes example. It inverts bit disable/enable POST.


/*Program for disabling/enabling IT8705 parallel port POST mode, Petr Cvek, petr.cvek@tul.cz*/

#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>

#define IT8705 0x2e     /*first SuperIO index=0x2e, second SuperIO index=0x4e*/

int write8705(int index,int data)
    {
    outb(index, IT8705);
    usleep(100);
    outb(data, IT8705+1);
    usleep(100);
    return(0);
    }

int read8705(int index)
    {
    outb(index, IT8705);
    usleep(100);
    return(inb(IT8705+1));
    usleep(100);
    }

int main()
    {
/*ALOCATE IT8705 PORTS*/
    if (ioperm(IT8705, 3, 1))
        {
        perror("ioperm");
        exit(1);
        }
    if (ioperm(IT8705+1, 3, 1))
        {
        perror("ioperm");
        exit(1);
        }
/*ENTER IT8705 CONFIG MODE*/
    outb(0x87, IT8705); usleep(100);
    outb(0x01, IT8705); usleep(100);
    outb(0x55, IT8705); usleep(100);
    if (IT8705==0x2e)
        {
        outb(0x55, IT8705);
        usleep(100);
        printf("First SuperIO\n");
        }
    else if (IT8705==0x4e)
        {
        outb(0xaa, IT8705);
        usleep(100);
        printf("Second SuperIO\n");
        }
/*POINT TO PART OF IT8705 TO BE MODIFICATED*/
    write8705(0x7, 0x3);        /*parport*/
/*READ DATA BEFORE CHANGE*/
    printf("Parport config reg before change: %d\n", read8705(0xf0));
/*PARALEL PORT CONFIG ENABLE/DISABLE POST ON PARPORT*/
    write8705(0xf0,(read8705(0xf0) + 0x8)); /*bit 3 POST, bits 4-7 reserved*/
/*READ DATA AFTER CHANGE*/
    printf("Parport config reg after change: %d\n", read8705(0xf0));
/*EXIT CONFIG MODE*/
    write8705(0x2,0x2);
/*UNALOCATE IT8705 PORTS*/
    if (ioperm(IT8705+1, 3, 0))
        {
        perror("ioperm");
        exit(1);
        }
    if (ioperm(IT8705, 3, 0))
        {
        perror("ioperm");
        exit(1);
        }
/*END*/
    exit(0);
    }
Comment 1 Natalie Protasevich 2007-11-12 13:51:16 UTC
Peter,
Can you test with current kernel (2.6.23+) by any chance.
Thanks.
Comment 2 Alan 2007-11-13 07:34:08 UTC
Grabbing this one as it doesn't really have an owner and it should be easy to sorted
Comment 3 Alan 2007-11-13 14:33:44 UTC
Interesting: Scanning the code we don't reset the device anywhere or touch the chip.

What happens if you build a kernel without parport_pc and without hwmon/it87 - can you tell which of the two if either is enabling it ?
Comment 4 Petr Cvek 2007-11-15 13:39:31 UTC
I tried to test this bug with kernel 2.6.24-rc2 and it makes noise, whether I compiled it with all parport/it87 or without parport/it87 modules support. The noise allways starts somewhere between exit bootmanager and detecting procesor.
Comment 5 Alan 2007-11-30 10:42:47 UTC
Ok thanks - that means the BIOS is not properly configuring this port, not that we are messing it up - which is good news.

I'll upload a test patch in a bit which tries to detect the port in question and turn off the debug stuff even if the BIOS forgot
Comment 6 Alan 2007-12-03 09:56:48 UTC
Created attachment 13839 [details]
Test patch

Test patch
Comment 7 Petr Cvek 2007-12-06 13:42:13 UTC
Created attachment 13896 [details]
Working patch

After correction some warnings and errors (just undefined variables, etc...), here is tested and working patch. Chip is detected properly and after loading parport_pc module noise is stopped.
Comment 8 Alan 2007-12-12 13:38:24 UTC
Petr can you send the patch to akpm@osdl.org with  a Signed-off-by: line as per

http://old.linux-foundation.org/newsroom/press_releases/2004/2004_05_24_dco.html

Alan
Comment 9 Petr Cvek 2007-12-18 01:52:47 UTC
OK patch has been resent.