aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-05-04 00:39:32 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-04 10:33:13 -0400
commit7fbacd5213a03b262bb17a826b166900e8b168ac (patch)
tree7f354174eccaaf6927e950829b8fbcdcc68570fb /drivers
parent5cae841b13f23ccdf7e38b2400b5cf57deb57ccf (diff)
[PATCH] ISA_DMA Kconfig fixes - part 2 (parport_pc)
Part of parport_pc that uses ISA DMA helpers made conditional on CONFIG_ISA_DMA_API. As the result, driver got usable for boxen that do not have ISA DMA stuff and have normal PCI parport card stuck into them - these never use DMA anyway. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/parport/Kconfig2
-rw-r--r--drivers/parport/parport_pc.c34
2 files changed, 25 insertions, 11 deletions
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 731010e0e6f6..16a2e6ae37f4 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -34,7 +34,7 @@ config PARPORT
34 34
35config PARPORT_PC 35config PARPORT_PC
36 tristate "PC-style hardware" 36 tristate "PC-style hardware"
37 depends on PARPORT && (!SPARC64 || PCI) && (!SPARC32 || BROKEN) 37 depends on PARPORT && (!SPARC64 || PCI) && !SPARC32
38 ---help--- 38 ---help---
39 You should say Y here if you have a PC-style parallel port. All 39 You should say Y here if you have a PC-style parallel port. All
40 IBM PC compatible computers and some Alphas have PC-style 40 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 c5774e7855d0..e7f3bcb79000 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -67,6 +67,10 @@
67 67
68#define PARPORT_PC_MAX_PORTS PARPORT_MAX 68#define PARPORT_PC_MAX_PORTS PARPORT_MAX
69 69
70#ifdef CONFIG_ISA_DMA_API
71#define HAS_DMA
72#endif
73
70/* ECR modes */ 74/* ECR modes */
71#define ECR_SPP 00 75#define ECR_SPP 00
72#define ECR_PS2 01 76#define ECR_PS2 01
@@ -610,6 +614,7 @@ dump_parport_state ("leave fifo_write_block_pio", port);
610 return length - left; 614 return length - left;
611} 615}
612 616
617#ifdef HAS_DMA
613static size_t parport_pc_fifo_write_block_dma (struct parport *port, 618static size_t parport_pc_fifo_write_block_dma (struct parport *port,
614 const void *buf, size_t length) 619 const void *buf, size_t length)
615{ 620{
@@ -732,6 +737,17 @@ dump_parport_state ("enter fifo_write_block_dma", port);
732dump_parport_state ("leave fifo_write_block_dma", port); 737dump_parport_state ("leave fifo_write_block_dma", port);
733 return length - left; 738 return length - left;
734} 739}
740#endif
741
742static inline size_t parport_pc_fifo_write_block(struct parport *port,
743 const void *buf, size_t length)
744{
745#ifdef HAS_DMA
746 if (port->dma != PARPORT_DMA_NONE)
747 return parport_pc_fifo_write_block_dma (port, buf, length);
748#endif
749 return parport_pc_fifo_write_block_pio (port, buf, length);
750}
735 751
736/* Parallel Port FIFO mode (ECP chipsets) */ 752/* Parallel Port FIFO mode (ECP chipsets) */
737static size_t parport_pc_compat_write_block_pio (struct parport *port, 753static 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,
758 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; 774 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
759 775
760 /* Write the data to the FIFO. */ 776 /* Write the data to the FIFO. */
761 if (port->dma != PARPORT_DMA_NONE) 777 written = parport_pc_fifo_write_block(port, buf, length);
762 written = parport_pc_fifo_write_block_dma (port, buf, length);
763 else
764 written = parport_pc_fifo_write_block_pio (port, buf, length);
765 778
766 /* Finish up. */ 779 /* Finish up. */
767 /* For some hardware we don't want to touch the mode until 780 /* 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,
856 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; 869 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
857 870
858 /* Write the data to the FIFO. */ 871 /* Write the data to the FIFO. */
859 if (port->dma != PARPORT_DMA_NONE) 872 written = parport_pc_fifo_write_block(port, buf, length);
860 written = parport_pc_fifo_write_block_dma (port, buf, length);
861 else
862 written = parport_pc_fifo_write_block_pio (port, buf, length);
863 873
864 /* Finish up. */ 874 /* Finish up. */
865 /* For some hardware we don't want to touch the mode until 875 /* 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,
2285 } 2295 }
2286 2296
2287#ifdef CONFIG_PARPORT_PC_FIFO 2297#ifdef CONFIG_PARPORT_PC_FIFO
2298#ifdef HAS_DMA
2288 if (p->dma != PARPORT_DMA_NONE) { 2299 if (p->dma != PARPORT_DMA_NONE) {
2289 if (request_dma (p->dma, p->name)) { 2300 if (request_dma (p->dma, p->name)) {
2290 printk (KERN_WARNING "%s: dma %d in use, " 2301 printk (KERN_WARNING "%s: dma %d in use, "
@@ -2306,7 +2317,8 @@ struct parport *parport_pc_probe_port (unsigned long int base,
2306 } 2317 }
2307 } 2318 }
2308 } 2319 }
2309#endif /* CONFIG_PARPORT_PC_FIFO */ 2320#endif
2321#endif
2310 } 2322 }
2311 2323
2312 /* Done probing. Now put the port into a sensible start-up state. */ 2324 /* Done probing. Now put the port into a sensible start-up state. */
@@ -2367,11 +2379,13 @@ void parport_pc_unregister_port (struct parport *p)
2367 if (p->modes & PARPORT_MODE_ECP) 2379 if (p->modes & PARPORT_MODE_ECP)
2368 release_region(p->base_hi, 3); 2380 release_region(p->base_hi, 3);
2369#ifdef CONFIG_PARPORT_PC_FIFO 2381#ifdef CONFIG_PARPORT_PC_FIFO
2382#ifdef HAS_DMA
2370 if (priv->dma_buf) 2383 if (priv->dma_buf)
2371 pci_free_consistent(priv->dev, PAGE_SIZE, 2384 pci_free_consistent(priv->dev, PAGE_SIZE,
2372 priv->dma_buf, 2385 priv->dma_buf,
2373 priv->dma_handle); 2386 priv->dma_handle);
2374#endif /* CONFIG_PARPORT_PC_FIFO */ 2387#endif
2388#endif
2375 kfree (p->private_data); 2389 kfree (p->private_data);
2376 parport_put_port(p); 2390 parport_put_port(p);
2377 kfree (ops); /* hope no-one cached it */ 2391 kfree (ops); /* hope no-one cached it */