From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 23609 invoked from network); 4 Jul 1999 15:30:20 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 4 Jul 1999 15:30:20 -0000 Received: from finch-post-10.mail.demon.net (finch-post-10.mail.demon.net [194.217.242.38]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id LAA10858 for ; Sun, 4 Jul 1999 11:28:14 -0400 Received: from treblig.demon.co.uk ([194.222.210.232] helo=tardis) by finch-post-10.mail.demon.net with esmtp (Exim 2.12 #1) id 110oBg-0004C8-0A for axp-list@redhat.com; Sun, 4 Jul 1999 15:28:12 +0000 Date: Sun, 4 Jul 1999 16:24:12 +0100 (BST) From: Dave Gilbert X-Sender: gilbertd@tardis.home.dave To: axp-list@redhat.com Subject: Latest (last?) instalment on LX parallel port Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi, I have some code now which switches the LX parallel port into EPP-32 mode - my scanner now flies pretty fast; and pretty reliable as well. The code is below for those interested - could someone suggest where this should live? I tacked it into the header of a module just to get it to load. Does anything other than the LX (mis-)use this chip?? The code moves the base address of the printer port to 0x378 (the address the BIOS uses can not be used for EPP) and turns the mode into EPP. It would be easy to change it I think to allow ECP for anyone who wants it. Dave ------------------------------------------------------------------------ unsigned int flags; unsigned int smcbase=0x370; /* Who knows ???*/ unsigned int devid,devrev; unsigned int ppmode,ppbase,ppmode2; printk("DAG hack to init LX SMC chip\n"); save_flags(flags); cli(); /* Enter config mode */ outb(0x55,smcbase); outb(0x55,smcbase); /* Read device ID, revision */ outb(0x20,smcbase); /* Select dev. ID reg */ devid=inb(smcbase+1); outb(0x21,smcbase); /* Device revision */ devrev=inb(smcbase+1); /* Make current logical Device Parrell port (3) */ outb(0x7,smcbase); outb(0x3,smcbase+1); /* Deactivate port */ outb(0x30,smcbase); outb(0,smcbase+1); /* Deactivate */ /* Read Parallel port mode */ outb(0xF0,smcbase); ppmode=inb(smcbase+1); /* Read printer port base address */ outb(0x61,smcbase); ppbase=inb(smcbase+1); outb(0x60,smcbase); ppbase|=(inb(smcbase+1)<<8); /* Write new parallel port base - 0x378 - 8 byte aligned (EPP allowed) */ outb(0x61,smcbase); outb(0x78,smcbase+1); outb(0x60,smcbase); outb(0x03,smcbase+1); /* Write a new printer configuration */ outb(0xf0,smcbase); outb((1 /* EPP */) | (7<<3 /* ECP FIFO thresh */) ,smcbase+1); /* Read it back */ outb(0xF0,smcbase); ppmode2=inb(smcbase+1); /* Reactivate the parallel port */ outb(0x30,smcbase); outb(1,smcbase+1); /* activate */ /* Exit config mode */ outb_p(0x2,smcbase); /* Select config register */ outb_p(0xaa,smcbase+1);/* Code to exit config */ outb_p(0xaa,smcbase);/* Code to exit config (Direct to config port??)*/ restore_flags(flags); printk("DAG: SMC Device ID=%d Device Rev=%d ppmode=0x%x ppbase=0x%x ppmode2=0x%x\n",devid,devrev,ppmode,ppbase,ppmode2); -------------------------------------------------------------------- / Dr. David Alan Gilbert | Running Linux on | Happy \ \ gro.gilbert @ treblig.org | Alpha, x86, ARM and SPARC | In Hex / ____________________________|___ http://www.treblig.demon.co.uk __/