diff options
-rw-r--r-- | drivers/parport/Kconfig | 2 | ||||
-rw-r--r-- | drivers/parport/parport_pc.c | 34 | ||||
-rw-r--r-- | include/asm-sparc64/parport.h | 6 |
3 files changed, 31 insertions, 11 deletions
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig index 731010e0e6f..16a2e6ae37f 100644 --- a/drivers/parport/Kconfig +++ b/drivers/parport/Kconfig @@ -34,7 +34,7 @@ config PARPORT config PARPORT_PC tristate "PC-style hardware" - depends on PARPORT && (!SPARC64 || PCI) && (!SPARC32 || BROKEN) + depends on PARPORT && (!SPARC64 || PCI) && !SPARC32 ---help--- You should say Y here if you have a PC-style parallel port. All IBM PC compatible computers and some Alphas have PC-style diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index c5774e7855d..e7f3bcb7900 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -67,6 +67,10 @@ #define PARPORT_PC_MAX_PORTS PARPORT_MAX +#ifdef CONFIG_ISA_DMA_API +#define HAS_DMA +#endif + /* ECR modes */ #define ECR_SPP 00 #define ECR_PS2 01 @@ -610,6 +614,7 @@ dump_parport_state ("leave fifo_write_block_pio", port); return length - left; } +#ifdef HAS_DMA static size_t parport_pc_fifo_write_block_dma (struct parport *port, const void *buf, size_t length) { @@ -732,6 +737,17 @@ dump_parport_state ("enter fifo_write_block_dma", port); dump_parport_state ("leave fifo_write_block_dma", port); return length - left; } +#endif + +static inline size_t parport_pc_fifo_write_block(struct parport *port, + const void *buf, size_t length) +{ +#ifdef HAS_DMA + if (port->dma != PARPORT_DMA_NONE) + return parport_pc_fifo_write_block_dma (port, buf, length); +#endif + return parport_pc_fifo_write_block_pio (port, buf, length); +} /* Parallel Port FIFO mode (ECP chipsets) */ static size_t parport_pc_compat_write_block_pio (struct parport *port, @@ -758,10 +774,7 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port, port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; /* Write the data to the FIFO. */ - if (port->dma != PARPORT_DMA_NONE) - written = parport_pc_fifo_write_block_dma (port, buf, length); - else - written = parport_pc_fifo_write_block_pio (port, buf, length); + written = parport_pc_fifo_write_block(port, buf, length); /* Finish up. */ /* For some hardware we don't want to touch the mode until @@ -856,10 +869,7 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port, port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; /* Write the data to the FIFO. */ - if (port->dma != PARPORT_DMA_NONE) - written = parport_pc_fifo_write_block_dma (port, buf, length); - else - written = parport_pc_fifo_write_block_pio (port, buf, length); + written = parport_pc_fifo_write_block(port, buf, length); /* Finish up. */ /* For some hardware we don't want to touch the mode until @@ -2285,6 +2295,7 @@ struct parport *parport_pc_probe_port (unsigned long int base, } #ifdef CONFIG_PARPORT_PC_FIFO +#ifdef HAS_DMA if (p->dma != PARPORT_DMA_NONE) { if (request_dma (p->dma, p->name)) { printk (KERN_WARNING "%s: dma %d in use, " @@ -2306,7 +2317,8 @@ struct parport *parport_pc_probe_port (unsigned long int base, } } } -#endif /* CONFIG_PARPORT_PC_FIFO */ +#endif +#endif } /* Done probing. Now put the port into a sensible start-up state. */ @@ -2367,11 +2379,13 @@ void parport_pc_unregister_port (struct parport *p) if (p->modes & PARPORT_MODE_ECP) release_region(p->base_hi, 3); #ifdef CONFIG_PARPORT_PC_FIFO +#ifdef HAS_DMA if (priv->dma_buf) pci_free_consistent(priv->dev, PAGE_SIZE, priv->dma_buf, priv->dma_handle); -#endif /* CONFIG_PARPORT_PC_FIFO */ +#endif +#endif kfree (p->private_data); parport_put_port(p); kfree (ops); /* hope no-one cached it */ diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index ab88349ddad..b7e635544ce 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h @@ -13,6 +13,12 @@ #define PARPORT_PC_MAX_PORTS PARPORT_MAX +/* + * While sparc64 doesn't have an ISA DMA API, we provide something that looks + * close enough to make parport_pc happy + */ +#define HAS_DMA + static struct sparc_ebus_info { struct ebus_dma_info info; unsigned int addr; |