From: Dave Gilbert <gilbertd@treblig.org>
To: axp-list@redhat.com
Subject: Latest (last?) instalment on LX parallel port
Date: Sun, 4 Jul 1999 16:24:12 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.10.9907041621070.642-100000@tardis.home.dave> (raw)
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 __/
reply other threads:[~1999-07-04 15:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox