add support for PC-9800 architecture (parport)
Subsystems (2)
PATCH 13/23 add support for PC-9800 architecture (parport)
This is a part 13/23 of patchset for add support NEC PC-9800 architecture, against 2.5.44.
Summary:
parallel drivers
- add new driver for support legacy PC-9800 printer port.
- IO address change (parport_pc)
- IRQ number change (parport_pc)
diffstat:
drivers/char/Config.in | 9 drivers/char/lp_old98.c | 577 +++++++++++++++++++++++++++++++++++++++++++ drivers/parport/parport_pc.c | 68 ++++- include/linux/parport_pc.h | 10 4 files changed, 659 insertions(+), 5 deletions(-)
patch:
drivers/parport/parport_pc.c +63 -5
@@ -85,6 +85,8 @@ #define DPRINTK(stuff...)#endif +/* Indicates PC-9800 architecture No:0 Yes:1 */ +extern int pc98;#define NR_SUPERIOS 3 static struct superio_struct { /* For Super-IO chips autodetection */
@@ -332,7 +334,10 @@unsigned char parport_pc_read_status (struct parport *p) { -return inb (STATUS (p)); +if (pc98 && p->base ==0x40 ) +return ((inb (0x42 ) &0x04 ) <<5 ) |PARPORT_STATUS_ERROR ; +else +return inb (STATUS (p)); }void parport_pc_disable_irq (struct parport *p)
@@ -1644,6 +1649,8 @@ {unsigned char r, w; +if (pc98 && pb->base ==0x40 ) +return PARPORT_MODE_PCSPP ;/* * first clear an eventually pending EPP timeout * I ([email protected]) have an SMSC chipset
@@ -1777,6 +1784,9 @@ {int ok =0 ; +if (pc98 && pb->base ==0x40 ) +return 0 ;/* never support */ +clear_epp_timeout (pb);/* try to tri-state the buffer */
@@ -1908,6 +1918,9 @@ config & 0x80 ? "Level" : "Pulses"); configb =inb (CONFIGB (pb)); +if (pc98 && (CONFIGB (pb) ==0x14d ) && ((configb &0x38 ) ==0x30 )) + configb = (configb & ~0x38 ) |0x28 ;/* IRQ 14 */ +printk (KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n" , pb->base, config, configb);printk (KERN_DEBUG "0x%lx: ECP settings irq=" , pb->base);
@@ -2048,6 +2061,9 @@ECR_WRITE (pb,ECR_CNF <<5 );/* Configuration MODE */ intrLine = (inb (CONFIGB (pb)) >>3 ) &0x07 ; +if (pc98 && (CONFIGB (pb) ==0x14d ) && (intrLine ==6 )) + intrLine =5 ;/* IRQ 14 */ + irq = lookup[intrLine];ECR_WRITE (pb, oecr);
@@ -2212,7 +2228,14 @@struct parport tmp;struct parport *p = &tmp;int probedirq =PARPORT_IRQ_NONE ; -if (check_region (base,3 ))return NULL ; +if (pc98 && base ==0x40 ) { +int i; +for (i =0 ; i <8 ; i +=2 ) +if (check_region (base + i,1 ))return NULL ; + }else { +if (check_region (base,3 ))return NULL ; + } + priv =kmalloc (sizeof (struct parport_pc_private ),GFP_KERNEL );if (!priv) {printk (KERN_DEBUG "parport (0x%lx): no memory!\n" , base);
@@ -2245,7 +2268,7 @@if (base_hi && !check_region (base_hi,3 ))parport_ECR_present (p); -if (base !=0x3bc ) { +if (!pc98 && base !=0x3bc ) {if (!check_region (base+0x3 ,5 )) {if (!parport_EPP_supported (p))parport_ECPEPP_supported (p);
@@ -2343,7 +2366,12 @@printk (KERN_INFO "%s: irq %d detected\n" , p->name, probedirq);parport_proc_register (p); -request_region (p->base,3 , p->name); +if (pc98 && p->base ==0x40 ) { +int i; +for (i =0 ; i <8 ; i +=2 ) +request_region (p->base + i,1 , p->name); + }else +request_region (p->base,3 , p->name);if (p->size >3 )request_region (p->base +3 , p->size -3 , p->name);if (p->modes &PARPORT_MODE_ECP )
@@ -2413,7 +2441,13 @@free_dma (p->dma);if (p->irq !=PARPORT_IRQ_NONE )free_irq (p->irq, p); -release_region (p->base,3 ); +if (pc98 && p->base ==0x40 ) { +int i; +for (i =0 ; i <8 ; i +=2 ) +release_region (p->base + i,1 ); + }else +release_region (p->base,3 ); +if (p->size >3 )release_region (p->base +3 , p->size -3 );if (p->modes &PARPORT_MODE_ECP )
@@ -2994,6 +3028,30 @@ {int count =0 ; +if (pc98) { +/* Set default resource settings for old style parport */ +int base =0x40 ; +int base_hi =0 ; +int irq =PARPORT_IRQ_NONE ; +int dma =PARPORT_DMA_NONE ; + +/* Check PC9800 old style parport */ +outb (inb (0x149 ) & ~0x10 ,0x149 );/* disable IEEE1284 */ +if (!(inb (0x149 ) &0x10 )) {/* IEEE1284 disabled ? */ +outb (inb (0x149 ) |0x10 ,0x149 );/* enable IEEE1284 */ +if (inb (0x149 ) &0x10 ) {/* IEEE1284 enabled ? */ +/* Set default settings for IEEE1284 parport */ + base =0x140 ; + base_hi =0x14c ; + irq =14 ; +/* dma = PARPORT_DMA_NONE; */ + } + } + +if (parport_pc_probe_port (base, base_hi, irq, dma,NULL )) + count++; + } +if (parport_pc_probe_port (0x3bc ,0x7bc , autoirq, autodma,NULL )) count++;if (parport_pc_probe_port (0x378 ,0x778 , autoirq, autodma,NULL ))
include/linux/parport_pc.h +10 -0
@@ -119,6 +119,11 @@#endif ctr = (ctr & ~mask) ^ val; ctr &= priv->ctr_writable;/* only write writable bits. */ +#ifdef CONFIG_PC9800 +if (p->base ==0x40 && ((priv->ctr) ^ ctr) &0x01 ) +outb (0x0e | ((ctr &0x01 ) ^0x01 ),0x46 ); + else +#endif /* CONFIG_PC9800 */ outb (ctr,CONTROL (p)); priv->ctr = ctr;/* Update soft copy */ return ctr;
@@ -191,6 +196,11 @@extern __inline__unsigned char parport_pc_read_status (struct parport *p) { +#ifdef CONFIG_PC9800 +if (p->base ==0x40 ) +return ((inb (0x42 ) &0x04 ) <<5 ) |PARPORT_STATUS_ERROR ; + else +#endif /* CONFIG_PC9800 */ return inb (STATUS (p)); }
drivers/char/Config.in +9 -0
@@ -85,6 +85,12 @@ if [ "$CONFIG_PPC_PSERIES" = "y" ]; then bool 'pSeries Hypervisor Virtual Console support' CONFIG_HVC_CONSOLE fi +if [ "$CONFIG_PC9800" = "y" -a "$CONFIG_PARPORT" != "y" ]; then + tristate 'NEC PC-9801 old-style printer port support' CONFIG_PC9800_OLDLP + if [ "$CONFIG_PC9800_OLDLP" != "n" ]; then + bool ' Support for console on line printer' CONFIG_PC9800_OLDLP_CONSOLE + fi +fi source drivers/i2c/Config.in
@@ -165,6 +171,9 @@ if [ "$CONFIG_IA64" = "y" ]; then bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC fi +if [ "$CONFIG_PC9800" = "y" ]; then + tristate 'PC-9801 Real Time Clock Support' CONFIG_RTC98 +fi if [ "$CONFIG_OBSOLETE" = "y" -a "$CONFIG_ALPHA_BOOK1" = "y" ]; then bool 'Tadpole ANA H8 Support (OBSOLETE)' CONFIG_H8 fi
drivers/char/lp_old98.c +577 -0
577 lines not on this page · raw message