add support for PC-9800 architecture (15/26) parport
Subsystems (2)
RFC PATCH 1/1 add support for PC-9800 architecture (15/26) parport
This is part 15/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
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 | 6 drivers/char/lp_old98.c | 580 +++++++++++++++++++++++++++++++++++++++++++ drivers/parport/parport_pc.c | 73 +++++ include/linux/parport_pc.h | 10 4 files changed, 669 insertions(+)
drivers/parport/parport_pc.c +73 -0
@@ -331,6 +331,11 @@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)); }
@@ -386,6 +391,7 @@ } #ifdef CONFIG_PARPORT_1284 +#ifndef CONFIG_PC9800 static size_t parport_pc_epp_read_data (struct parport *port, void *buf, size_t length, int flags) {
@@ -586,6 +592,7 @@return written; } +#endif /* !CONFIG_PC9800 */ #endif /* IEEE 1284 support */ #ifdef CONFIG_PARPORT_PC_FIFO
@@ -1643,6 +1650,11 @@ {unsigned char r, w; +#ifdef CONFIG_PC9800 +/* All driver must support this mode */ +if (pb->base ==0x40 ) +return PARPORT_MODE_PCSPP ; +#endif /* * first clear an eventually pending EPP timeout * I ([email protected]) have an SMSC chipset
@@ -1776,6 +1788,10 @@ {int ok =0 ; +#ifdef CONFIG_PC9800 +if (pb->base ==0x40 ) +return 0 ;/* never support */ +#endif clear_epp_timeout (pb);/* try to tri-state the buffer */
@@ -1907,6 +1923,10 @@ config & 0x80 ? "Level" : "Pulses"); configb =inb (CONFIGB (pb)); +#ifdef CONFIG_PC9800 +if ((CONFIGB (pb) ==0x14d ) && ((configb &0x38 ) ==0x30 )) + configb = (configb & ~0x38 ) |0x28 ;/* IRQ 14 */ +#endif 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);
@@ -1946,6 +1966,7 @@/* EPP mode detection */ +#ifndef CONFIG_PC9800 static int __devinit parport_EPP_supported (struct parport *pb) {const struct parport_pc_private *priv = pb->private_data;
@@ -2019,6 +2040,7 @@ return result; } +#endif /* !CONFIG_PC9800 */ #else /* No IEEE 1284 support */
@@ -2047,6 +2069,10 @@ECR_WRITE (pb,ECR_CNF <<5 );/* Configuration MODE */ intrLine = (inb (CONFIGB (pb)) >>3 ) &0x07 ; +#ifdef CONFIG_PC9800 +if ((CONFIGB (pb) ==0x14d ) && (intrLine ==6 )) + intrLine =5 ;/* IRQ 14 */ +#endif irq = lookup[intrLine];ECR_WRITE (pb, oecr);
@@ -2211,7 +2237,16 @@struct parport tmp;struct parport *p = &tmp;int probedirq =PARPORT_IRQ_NONE ; +#ifdef CONFIG_PC9800 +if (base ==0x40 ) { +if (check_region (base,-7 )) +return NULL ; + }else { +#endif if (check_region (base,3 ))return NULL ; +#ifdef CONFIG_PC9800 + } +#endif priv =kmalloc (sizeof (struct parport_pc_private ),GFP_KERNEL );if (!priv) {printk (KERN_DEBUG "parport (0x%lx): no memory!\n" , base);
@@ -2244,12 +2279,14 @@if (base_hi && !check_region (base_hi,3 ))parport_ECR_present (p); +#ifndef CONFIG_PC9800 /* EPP mode is not supported ? */ if (base !=0x3bc ) {if (!check_region (base+0x3 ,5 )) {if (!parport_EPP_supported (p))parport_ECPEPP_supported (p); } } +#endif if (!parport_SPP_supported (p)) {/* No port. */ kfree (priv);
@@ -2342,6 +2379,11 @@printk (KERN_INFO "%s: irq %d detected\n" , p->name, probedirq);parport_proc_register (p); +#ifdef CONFIG_PC9800 +if (p->base ==0x40 ) +request_region (p->base,-7 , p->name); + else +#endif request_region (p->base,3 , p->name);if (p->size >3 )request_region (p->base +3 , p->size -3 , p->name);
@@ -2412,6 +2454,11 @@free_dma (p->dma);if (p->irq !=PARPORT_IRQ_NONE )free_irq (p->irq, p); +#ifdef CONFIG_PC9800 +if (p->base ==0x40 ) +release_region (p->base,-7 ); + else +#endif release_region (p->base,3 );if (p->size >3 )release_region (p->base +3 , p->size -3 );
@@ -2974,12 +3021,38 @@ {int count =0 ; +#ifndef CONFIG_PC9800 if (parport_pc_probe_port (0x3bc ,0x7bc , autoirq, autodma,NULL )) count++;if (parport_pc_probe_port (0x378 ,0x778 , autoirq, autodma,NULL )) count++;if (parport_pc_probe_port (0x278 ,0x678 , autoirq, autodma,NULL )) count++; +#else /* CONFIG_PC9800 */ +/* 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 1 /* force using old style. debug by tomita */ +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; */ + } + } +#endif /* force using old style. debug by tomita */ + +if (parport_pc_probe_port (base, base_hi, irq, dma,NULL )) + count++; +#endif /* !CONFIG_PC9800 */ return count; }
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 +6 -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-9800 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
drivers/char/lp_old98.c +580 -0
580 lines not on this page · raw message