Lines Matching +full:south +full:- +full:field

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Low-level parallel-port routines for 8255-based PC-style hardware.
12 * Cleaned up include files - Russell King <linux@arm.uk.linux.org>
13 * DMA support - Bert De Jonghe <bert@sophis.be>
17 * Updated probing logic - Adam Belay <ambx1@neo.rr.com>
38 * only in register addresses (eg because your registers are on 32-bit
43 * but rather will start at port->base_hi.
55 #include <linux/dma-mapping.h>
91 static struct superio_struct { /* For Super-IO chips autodetection */
109 const struct parport_pc_private *priv = pb->physport->private_data; in frob_econtrol()
110 unsigned char ecr_writable = priv->ecr_writable; in frob_econtrol()
122 pr_debug("frob_econtrol(%02x,%02x): %02x -> %02x\n", m, v, ectr, new); in frob_econtrol()
136 -EBUSY: Could not drain FIFO in some finite amount of time,
141 const struct parport_pc_private *priv = p->physport->private_data; in change_mode()
145 pr_debug("parport change_mode ECP-ISA to mode 0x%02x\n", m); in change_mode()
147 if (!priv->ecr) { in change_mode()
158 if (mode >= 2 && !(priv->ctr & 0x20)) { in change_mode()
161 unsigned long expire = jiffies + p->physport->cad->timeout; in change_mode()
179 return -EBUSY; in change_mode()
236 s->u.pc.ctr = 0xc; in parport_pc_init_state()
237 if (dev->irq_func && in parport_pc_init_state()
238 dev->port->irq != PARPORT_IRQ_NONE) in parport_pc_init_state()
240 s->u.pc.ctr |= 0x10; in parport_pc_init_state()
242 s->u.pc.ecr = 0x34; /* NetMos chip can cause problems 0x24; in parport_pc_init_state()
248 const struct parport_pc_private *priv = p->physport->private_data; in parport_pc_save_state()
249 s->u.pc.ctr = priv->ctr; in parport_pc_save_state()
250 if (priv->ecr) in parport_pc_save_state()
251 s->u.pc.ecr = inb(ECONTROL(p)); in parport_pc_save_state()
257 struct parport_pc_private *priv = p->physport->private_data; in parport_pc_restore_state()
258 register unsigned char c = s->u.pc.ctr & priv->ctr_writable; in parport_pc_restore_state()
260 priv->ctr = c; in parport_pc_restore_state()
261 if (priv->ecr) in parport_pc_restore_state()
262 ECR_WRITE(p, s->u.pc.ecr); in parport_pc_restore_state()
290 left -= 16; in parport_pc_epp_read_data()
296 left--; in parport_pc_epp_read_data()
302 port->name); in parport_pc_epp_read_data()
321 return -EIO; in parport_pc_epp_read_data()
356 return -EIO; in parport_pc_epp_write_data()
381 return -EIO; in parport_pc_epp_read_addr()
407 return -EIO; in parport_pc_epp_write_addr()
489 unsigned long expire = jiffies + port->physport->cad->timeout; in parport_pc_fifo_write_block_pio()
492 const struct parport_pc_private *priv = port->physport->private_data; in parport_pc_fifo_write_block_pio()
493 const int fifo_depth = priv->fifo_depth; in parport_pc_fifo_write_block_pio()
495 port = port->physport; in parport_pc_fifo_write_block_pio()
515 if (port->waithead) { in parport_pc_fifo_write_block_pio()
548 expire = jiffies + port->cad->timeout; in parport_pc_fifo_write_block_pio()
559 left -= n; in parport_pc_fifo_write_block_pio()
562 if (i < (poll_for - 2)) in parport_pc_fifo_write_block_pio()
563 poll_for--; in parport_pc_fifo_write_block_pio()
571 /* Half-full(call me an optimist) */ in parport_pc_fifo_write_block_pio()
574 left--; in parport_pc_fifo_write_block_pio()
577 return length - left; in parport_pc_fifo_write_block_pio()
587 const struct parport_pc_private *priv = port->physport->private_data; in parport_pc_fifo_write_block_dma()
588 struct device *dev = port->physport->dev; in parport_pc_fifo_write_block_dma()
592 unsigned long end = (unsigned long) buf + length - 1; in parport_pc_fifo_write_block_dma()
598 maxlen = 0x10000 - (start & 0xffff); in parport_pc_fifo_write_block_dma()
603 /* above 16 MB we use a bounce buffer as ISA-DMA in parport_pc_fifo_write_block_dma()
605 maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */ in parport_pc_fifo_write_block_dma()
606 dma_addr = priv->dma_handle; in parport_pc_fifo_write_block_dma()
610 port = port->physport; in parport_pc_fifo_write_block_dma()
621 unsigned long expire = jiffies + port->physport->cad->timeout; in parport_pc_fifo_write_block_dma()
629 memcpy(priv->dma_buf, buf, count); in parport_pc_fifo_write_block_dma()
632 disable_dma(port->dma); in parport_pc_fifo_write_block_dma()
633 clear_dma_ff(port->dma); in parport_pc_fifo_write_block_dma()
634 set_dma_mode(port->dma, DMA_MODE_WRITE); in parport_pc_fifo_write_block_dma()
635 set_dma_addr(port->dma, dma_addr); in parport_pc_fifo_write_block_dma()
636 set_dma_count(port->dma, count); in parport_pc_fifo_write_block_dma()
644 enable_dma(port->dma); in parport_pc_fifo_write_block_dma()
648 left -= count; in parport_pc_fifo_write_block_dma()
672 disable_dma(port->dma); in parport_pc_fifo_write_block_dma()
673 clear_dma_ff(port->dma); in parport_pc_fifo_write_block_dma()
674 count = get_dma_residue(port->dma); in parport_pc_fifo_write_block_dma()
680 if (port->waithead) { in parport_pc_fifo_write_block_dma()
686 buf -= count; in parport_pc_fifo_write_block_dma()
689 dma_addr -= count; in parport_pc_fifo_write_block_dma()
694 disable_dma(port->dma); in parport_pc_fifo_write_block_dma()
695 clear_dma_ff(port->dma); in parport_pc_fifo_write_block_dma()
696 left += get_dma_residue(port->dma); in parport_pc_fifo_write_block_dma()
706 return length - left; in parport_pc_fifo_write_block_dma()
714 if (port->dma != PARPORT_DMA_NONE) in parport_pc_fifo_write_block()
728 const struct parport_pc_private *priv = port->physport->private_data; in parport_pc_compat_write_block_pio()
732 if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) in parport_pc_compat_write_block_pio()
742 port->name); in parport_pc_compat_write_block_pio()
744 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; in parport_pc_compat_write_block_pio()
754 expire = jiffies + (priv->fifo_depth * HZ * 4); in parport_pc_compat_write_block_pio()
758 if (r != -EBUSY) in parport_pc_compat_write_block_pio()
761 if (r == -EBUSY) { in parport_pc_compat_write_block_pio()
763 printk(KERN_DEBUG "%s: FIFO is stuck\n", port->name); in parport_pc_compat_write_block_pio()
769 for (written -= priv->fifo_depth; ; written++) { in parport_pc_compat_write_block_pio()
786 port->name, r); in parport_pc_compat_write_block_pio()
788 port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_pc_compat_write_block_pio()
802 const struct parport_pc_private *priv = port->physport->private_data; in parport_pc_ecp_write_block_pio()
806 if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) in parport_pc_ecp_write_block_pio()
811 if (port->physport->ieee1284.phase != IEEE1284_PH_FWD_IDLE) { in parport_pc_ecp_write_block_pio()
825 port->name, r); in parport_pc_ecp_write_block_pio()
838 port->name); in parport_pc_ecp_write_block_pio()
839 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; in parport_pc_ecp_write_block_pio()
849 expire = jiffies + (priv->fifo_depth * (HZ * 4)); in parport_pc_ecp_write_block_pio()
853 if (r != -EBUSY) in parport_pc_ecp_write_block_pio()
856 if (r == -EBUSY) { in parport_pc_ecp_write_block_pio()
858 printk(KERN_DEBUG "%s: FIFO is stuck\n", port->name); in parport_pc_ecp_write_block_pio()
864 for (written -= priv->fifo_depth; ; written++) { in parport_pc_ecp_write_block_pio()
882 port->name, r); in parport_pc_ecp_write_block_pio()
892 port->name, r); in parport_pc_ecp_write_block_pio()
900 port->name, r); in parport_pc_ecp_write_block_pio()
902 port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_pc_ecp_write_block_pio()
916 /* GCC is not inlining extern inline function later overwritten to non-inline,
966 /* Super-IO chipset detection, Winbond, SMSC */
998 /* The documentation calls DMA and IRQ-Lines by letters, so in show_parconfig_smsc37c669()
1000 appropriately/randomly... G=reserved H=IDE-irq, */ in show_parconfig_smsc37c669()
1003 (cr27 & 0x0f) ? 'A' - 1 + (cr27 & 0x0f) : '-', in show_parconfig_smsc37c669()
1004 (cr26 & 0x0f) ? 'A' - 1 + (cr26 & 0x0f) : '-', in show_parconfig_smsc37c669()
1016 the choices to standard settings, i.e. io-address and IRQ in show_parconfig_smsc37c669()
1022 pr_info("Super-IO: too many chips!\n"); in show_parconfig_smsc37c669()
1027 s->io = 0x3bc; in show_parconfig_smsc37c669()
1028 s->irq = 7; in show_parconfig_smsc37c669()
1031 s->io = 0x378; in show_parconfig_smsc37c669()
1032 s->irq = 7; in show_parconfig_smsc37c669()
1035 s->io = 0x278; in show_parconfig_smsc37c669()
1036 s->irq = 5; in show_parconfig_smsc37c669()
1040 s->dma = d; in show_parconfig_smsc37c669()
1042 s->dma = PARPORT_DMA_NONE; in show_parconfig_smsc37c669()
1054 "EPP-1.9 and SPP", in show_parconfig_winbond()
1056 "ECP and EPP-1.9", in show_parconfig_winbond()
1058 "EPP-1.7 and SPP", /* 5 */ in show_parconfig_winbond()
1060 "ECP and EPP-1.7" }; in show_parconfig_winbond()
1062 "pulsed low, high-Z", in show_parconfig_winbond()
1065 /* The registers are called compatible-PnP because the in show_parconfig_winbond()
1066 register layout is modelled after ISA-PnP, the access in show_parconfig_winbond()
1104 pr_info("Super-IO: too many chips!\n"); in show_parconfig_winbond()
1106 s->io = (cr60 << 8) | cr61; in show_parconfig_winbond()
1107 s->irq = cr70 & 0x0f; in show_parconfig_winbond()
1108 s->dma = (((cr74 & 0x07) > 3) ? in show_parconfig_winbond()
1121 non-winbond register */ in decode_winbond()
1127 confirm 83977TF is correct :-) */ in decode_winbond()
1173 non-smsc register */ in decode_smsc()
1324 printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n"); in detect_and_report_winbond()
1337 printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n"); in detect_and_report_smsc()
1349 printk(KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n"); in detect_and_report_it87()
1383 if (superios[i].io == p->base) in find_superio()
1392 return s->dma; in get_superio_dma()
1400 return s->irq; in get_superio_irq()
1405 /* --- Mode detection ------------------------------------- */
1428 /* Do a simple read-write test to make sure the port exists. */ in parport_SPP_supported()
1451 pb->base, w, r); in parport_SPP_supported()
1453 /* Try the data register. The data lines aren't tri-stated at in parport_SPP_supported()
1470 pb->base, w, r); in parport_SPP_supported()
1472 pb->base); in parport_SPP_supported()
1498 struct parport_pc_private *priv = pb->private_data; in parport_ECR_present()
1501 if (!priv->ecr_writable) { in parport_ECR_present()
1520 priv->ecr = 1; in parport_ECR_present()
1542 * Some SPP ports have "half PS/2" ability - you can't turn off the line
1557 /* try to tri-state the buffer */ in parport_PS2_supported()
1572 pb->modes |= PARPORT_MODE_TRISTATE; in parport_PS2_supported()
1574 struct parport_pc_private *priv = pb->private_data; in parport_PS2_supported()
1575 priv->ctr_writable &= ~0x20; in parport_PS2_supported()
1587 struct parport_pc_private *priv = pb->private_data; in parport_ECP_supported()
1592 if (!priv->ecr) in parport_ECP_supported()
1610 priv->fifo_depth = i; in parport_ECP_supported()
1612 printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); in parport_ECP_supported()
1617 for (i = 1; i <= priv->fifo_depth; i++) { in parport_ECP_supported()
1624 if (i <= priv->fifo_depth) { in parport_ECP_supported()
1627 pb->base, i); in parport_ECP_supported()
1633 priv->writeIntrThreshold = i; in parport_ECP_supported()
1641 for (i = 1; i <= priv->fifo_depth; i++) { in parport_ECP_supported()
1647 if (i <= priv->fifo_depth) { in parport_ECP_supported()
1650 pb->base, i); in parport_ECP_supported()
1655 priv->readIntrThreshold = i; in parport_ECP_supported()
1664 pr_warn("0x%lx: Unsupported pword size!\n", pb->base); in parport_ECP_supported()
1668 pr_warn("0x%lx: Unsupported pword size!\n", pb->base); in parport_ECP_supported()
1671 pr_warn("0x%lx: Unknown implementation ID\n", pb->base); in parport_ECP_supported()
1676 priv->pword = pword; in parport_ECP_supported()
1680 pb->base, 8 * pword); in parport_ECP_supported()
1682 printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", in parport_ECP_supported()
1683 pb->base, config & 0x80 ? "Level" : "Pulses"); in parport_ECP_supported()
1687 pb->base, config, configb); in parport_ECP_supported()
1688 printk(KERN_DEBUG "0x%lx: ECP settings irq=", pb->base); in parport_ECP_supported()
1710 const struct parport_pc_private *priv = pb->private_data; in intel_bug_present_check_epp()
1713 if (priv->ecr) { in intel_bug_present_check_epp()
1734 if (pb->dev != NULL) { in intel_bug_present()
1749 const struct parport_pc_private *priv = pb->private_data; in parport_ECPPS2_supported()
1753 if (!priv->ecr) in parport_ECPPS2_supported()
1788 pb->modes |= PARPORT_MODE_EPP; in parport_EPP_supported()
1791 pb->ops->epp_read_data = parport_pc_epp_read_data; in parport_EPP_supported()
1792 pb->ops->epp_write_data = parport_pc_epp_write_data; in parport_EPP_supported()
1793 pb->ops->epp_read_addr = parport_pc_epp_read_addr; in parport_EPP_supported()
1794 pb->ops->epp_write_addr = parport_pc_epp_write_addr; in parport_EPP_supported()
1801 struct parport_pc_private *priv = pb->private_data; in parport_ECPEPP_supported()
1805 if (!priv->ecr) in parport_ECPEPP_supported()
1818 pb->ops->epp_read_data = parport_pc_ecpepp_read_data; in parport_ECPEPP_supported()
1819 pb->ops->epp_write_data = parport_pc_ecpepp_write_data; in parport_ECPEPP_supported()
1820 pb->ops->epp_read_addr = parport_pc_ecpepp_read_addr; in parport_ECPEPP_supported()
1821 pb->ops->epp_write_addr = parport_pc_ecpepp_write_addr; in parport_ECPEPP_supported()
1854 /* --- IRQ detection -------------------------------------- */
1889 pb->irq = probe_irq_off(irqs); in irq_probe_ECP()
1892 if (pb->irq <= 0) in irq_probe_ECP()
1893 pb->irq = PARPORT_IRQ_NONE; in irq_probe_ECP()
1895 return pb->irq; in irq_probe_ECP()
1910 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1915 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1929 pb->irq = probe_irq_off(irqs); in irq_probe_EPP()
1930 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1934 if (pb->irq <= 0) in irq_probe_EPP()
1935 pb->irq = PARPORT_IRQ_NONE; in irq_probe_EPP()
1937 return pb->irq; in irq_probe_EPP()
1956 struct parport_pc_private *priv = pb->private_data; in parport_irq_probe()
1958 if (priv->ecr) { in parport_irq_probe()
1959 pb->irq = programmable_irq_support(pb); in parport_irq_probe()
1961 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1962 pb->irq = irq_probe_ECP(pb); in parport_irq_probe()
1965 if ((pb->irq == PARPORT_IRQ_NONE) && priv->ecr && in parport_irq_probe()
1966 (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
1967 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
1971 if (pb->irq == PARPORT_IRQ_NONE && (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
1972 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
1976 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1977 pb->irq = irq_probe_SPP(pb); in parport_irq_probe()
1979 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1980 pb->irq = get_superio_irq(pb); in parport_irq_probe()
1982 return pb->irq; in parport_irq_probe()
1985 /* --- DMA detection -------------------------------------- */
1996 /* 000: Indicates jumpered 8-bit DMA if read-only. in programmable_dma_support()
1997 100: Indicates jumpered 16-bit DMA if read-only. */ in programmable_dma_support()
2007 const struct parport_pc_private *priv = p->private_data; in parport_dma_probe()
2008 if (priv->ecr) /* ask ECP chipset first */ in parport_dma_probe()
2009 p->dma = programmable_dma_support(p); in parport_dma_probe()
2010 if (p->dma == PARPORT_DMA_NONE) { in parport_dma_probe()
2011 /* ask known Super-IO chips proper, although these in parport_dma_probe()
2014 p->dma = get_superio_dma(p); in parport_dma_probe()
2017 return p->dma; in parport_dma_probe()
2020 /* --- Initialisation code -------------------------------- */
2050 dev = &pdev->dev; in __parport_pc_probe_port()
2067 /* a misnomer, actually - it's allocate and reserve parport number */ in __parport_pc_probe_port()
2072 base_res = request_region(base, 3, p->name); in __parport_pc_probe_port()
2077 priv->ctr = 0xc; in __parport_pc_probe_port()
2078 priv->ctr_writable = ~0x10; in __parport_pc_probe_port()
2079 priv->ecr = 0; in __parport_pc_probe_port()
2080 priv->ecr_writable = ecr_writable; in __parport_pc_probe_port()
2081 priv->fifo_depth = 0; in __parport_pc_probe_port()
2082 priv->dma_buf = NULL; in __parport_pc_probe_port()
2083 priv->dma_handle = 0; in __parport_pc_probe_port()
2084 INIT_LIST_HEAD(&priv->list); in __parport_pc_probe_port()
2085 priv->port = p; in __parport_pc_probe_port()
2087 p->dev = dev; in __parport_pc_probe_port()
2088 p->base_hi = base_hi; in __parport_pc_probe_port()
2089 p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; in __parport_pc_probe_port()
2090 p->private_data = priv; in __parport_pc_probe_port()
2093 ECR_res = request_region(base_hi, 3, p->name); in __parport_pc_probe_port()
2099 EPP_res = request_region(base+0x3, 5, p->name); in __parport_pc_probe_port()
2107 if (priv->ecr) in __parport_pc_probe_port()
2112 p->size = (p->modes & PARPORT_MODE_EPP) ? 8 : 3; in __parport_pc_probe_port()
2114 pr_info("%s: PC-style at 0x%lx", p->name, p->base); in __parport_pc_probe_port()
2115 if (p->base_hi && priv->ecr) in __parport_pc_probe_port()
2116 pr_cont(" (0x%lx)", p->base_hi); in __parport_pc_probe_port()
2117 if (p->irq == PARPORT_IRQ_AUTO) { in __parport_pc_probe_port()
2118 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2120 } else if (p->irq == PARPORT_IRQ_PROBEONLY) { in __parport_pc_probe_port()
2121 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2123 probedirq = p->irq; in __parport_pc_probe_port()
2124 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2126 if (p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2127 pr_cont(", irq %d", p->irq); in __parport_pc_probe_port()
2128 priv->ctr_writable |= 0x10; in __parport_pc_probe_port()
2130 if (p->dma == PARPORT_DMA_AUTO) { in __parport_pc_probe_port()
2131 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2135 if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq in __parport_pc_probe_port()
2137 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2141 p->dma != PARPORT_DMA_NOFIFO && in __parport_pc_probe_port()
2142 priv->fifo_depth > 0 && p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2143 p->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT; in __parport_pc_probe_port()
2144 if (p->dma != PARPORT_DMA_NONE) in __parport_pc_probe_port()
2145 p->modes |= PARPORT_MODE_DMA; in __parport_pc_probe_port()
2148 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2151 p->modes &= ~mode_mask; in __parport_pc_probe_port()
2154 if ((p->modes & PARPORT_MODE_COMPAT) != 0) in __parport_pc_probe_port()
2155 p->ops->compat_write_data = parport_pc_compat_write_block_pio; in __parport_pc_probe_port()
2157 if ((p->modes & PARPORT_MODE_ECP) != 0) in __parport_pc_probe_port()
2158 p->ops->ecp_write_data = parport_pc_ecp_write_block_pio; in __parport_pc_probe_port()
2160 if ((p->modes & (PARPORT_MODE_ECP | PARPORT_MODE_COMPAT)) != 0) { in __parport_pc_probe_port()
2161 if ((p->modes & PARPORT_MODE_DMA) != 0) in __parport_pc_probe_port()
2162 pr_cont(", dma %d", p->dma); in __parport_pc_probe_port()
2172 if (p->modes & PARPORT_MODE_##x) \ in __parport_pc_probe_port()
2191 pr_info("%s: irq %d detected\n", p->name, probedirq); in __parport_pc_probe_port()
2194 if (ECR_res && (p->modes & PARPORT_MODE_ECP) == 0) { in __parport_pc_probe_port()
2199 if (EPP_res && (p->modes & PARPORT_MODE_EPP) == 0) { in __parport_pc_probe_port()
2203 if (p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2204 if (request_irq(p->irq, parport_irq_handler, in __parport_pc_probe_port()
2205 irqflags, p->name, p)) { in __parport_pc_probe_port()
2207 p->name, p->irq); in __parport_pc_probe_port()
2208 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2209 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2214 if (p->dma != PARPORT_DMA_NONE) { in __parport_pc_probe_port()
2215 if (request_dma(p->dma, p->name)) { in __parport_pc_probe_port()
2217 p->name, p->dma); in __parport_pc_probe_port()
2218 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2220 priv->dma_buf = in __parport_pc_probe_port()
2223 &priv->dma_handle, in __parport_pc_probe_port()
2225 if (!priv->dma_buf) { in __parport_pc_probe_port()
2227 p->name); in __parport_pc_probe_port()
2228 free_dma(p->dma); in __parport_pc_probe_port()
2229 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2237 /* Done probing. Now put the port into a sensible start-up state. */ in __parport_pc_probe_port()
2238 if (priv->ecr) in __parport_pc_probe_port()
2249 found out its characteristics, let the high-level drivers in __parport_pc_probe_port()
2252 list_add(&priv->list, &ports_list); in __parport_pc_probe_port()
2289 struct parport_pc_private *priv = p->private_data; in parport_pc_unregister_port()
2290 struct parport_operations *ops = p->ops; in parport_pc_unregister_port()
2294 list_del_init(&priv->list); in parport_pc_unregister_port()
2297 if (p->dma != PARPORT_DMA_NONE) in parport_pc_unregister_port()
2298 free_dma(p->dma); in parport_pc_unregister_port()
2300 if (p->irq != PARPORT_IRQ_NONE) in parport_pc_unregister_port()
2301 free_irq(p->irq, p); in parport_pc_unregister_port()
2302 release_region(p->base, 3); in parport_pc_unregister_port()
2303 if (p->size > 3) in parport_pc_unregister_port()
2304 release_region(p->base + 3, p->size - 3); in parport_pc_unregister_port()
2305 if (p->modes & PARPORT_MODE_ECP) in parport_pc_unregister_port()
2306 release_region(p->base_hi, 3); in parport_pc_unregister_port()
2308 if (priv->dma_buf) in parport_pc_unregister_port()
2309 dma_free_coherent(p->physport->dev, PAGE_SIZE, in parport_pc_unregister_port()
2310 priv->dma_buf, in parport_pc_unregister_port()
2311 priv->dma_handle); in parport_pc_unregister_port()
2313 kfree(p->private_data); in parport_pc_unregister_port()
2315 kfree(ops); /* hope no-one cached it */ in parport_pc_unregister_port()
2379 pr_info("parport_pc: please mail 'lspci -nvv' output to Rich.Liu@ite.com.tw\n"); in sio_ite_8872_probe()
2411 irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { in sio_ite_8872_probe()
2493 pci_read_config_byte(pdev, via->via_pci_superio_config_reg, &tmp); in sio_via_probe()
2494 tmp |= via->via_pci_superio_config_data; in sio_via_probe()
2495 pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp); in sio_via_probe()
2497 /* Bits 1-0: Parallel Port Mode / Enable */ in sio_via_probe()
2498 outb(via->viacfg_function, VIA_CONFIG_INDEX); in sio_via_probe()
2501 outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); in sio_via_probe()
2509 outb(via->viacfg_function, VIA_CONFIG_INDEX); in sio_via_probe()
2513 outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); in sio_via_probe()
2517 /* Parallel Port I/O Base Address, bits 9-2 */ in sio_via_probe()
2518 outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); in sio_via_probe()
2524 outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); in sio_via_probe()
2533 pci_read_config_byte(pdev, via->via_pci_superio_config_reg, &tmp); in sio_via_probe()
2534 tmp &= ~via->via_pci_superio_config_data; in sio_via_probe()
2535 pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp); in sio_via_probe()
2542 /* Bits 7-4: PnP Routing for Parallel Port IRQ */ in sio_via_probe()
2543 pci_read_config_byte(pdev, via->via_pci_parport_irq_reg, &tmp); in sio_via_probe()
2547 /* Bits 3-2: PnP Routing for Parallel Port DMA */ in sio_via_probe()
2548 pci_read_config_byte(pdev, via->via_pci_parport_dma_reg, &tmp); in sio_via_probe()
2590 if (parport_pc_probe_port(port1, port2, irq, dma, &pdev->dev, 0)) { in sio_via_probe()
2608 sio_via_8231, /* Via VT8231 south bridge integrated Super IO */
2674 /* -1 if not there, >6 for offset-method (max BAR is 6) */
2677 /* Bit field of parport modes to exclude. */
2680 /* If non-zero, sets the bitmask of writable ECR bits. In that
2685 * If it returns non-zero, no probing will take place and the
2690 * is non-zero we couldn't use any of the ports. */
2697 /* lava_parallel */ { 1, { { 0, -1 }, } },
2698 /* lava_parallel_dual_a */ { 1, { { 0, -1 }, } },
2699 /* lava_parallel_dual_b */ { 1, { { 0, -1 }, } },
2700 /* boca_ioppar */ { 1, { { 0, -1 }, } },
2701 /* plx_9050 */ { 2, { { 4, -1 }, { 5, -1 }, } },
2702 /* timedia_4006a */ { 1, { { 0, -1 }, } },
2703 /* timedia_4014 */ { 2, { { 0, -1 }, { 2, -1 }, } },
2711 /* titan_010l */ { 1, { { 3, -1 }, } },
2727 /* aks_0100 */ { 1, { { 0, -1 }, } },
2729 /* netmos_9900 */ { 1, { { 0, -1 }, } },
2732 /* netmos_9705 */ { 1, { { 0, -1 }, } },
2737 /* netmos_9901 */ { 1, { { 0, -1 }, } },
2738 /* netmos_9865 */ { 1, { { 0, -1 }, } },
2741 /* wch_ch382l */ { 1, { { 2, -1 }, } },
2742 /* brainboxes_uc146 */ { 1, { { 3, -1 }, } },
2743 /* brainboxes_px203 */ { 1, { { 0, -1 }, } },
2747 /* Super-IO onboard chips */
2835 /* Quatech SPPXP-100 Parallel port PCI ExpressCard */
2838 /* WCH CH382L PCI-E single parallel port card */
2840 /* Brainboxes IX-500/550 */
2843 /* Brainboxes UC-146/UC-157 */
2848 /* Brainboxes PX-146/PX-257 */
2851 /* Brainboxes PX-203 */
2854 /* Brainboxes PX-475 */
2869 int err, count, n, i = id->driver_data; in parport_pc_pci_probe()
2873 /* This is an onboard Super-IO and has already been probed */ in parport_pc_pci_probe()
2877 i -= last_sio; in parport_pc_pci_probe()
2885 return -ENOMEM; in parport_pc_pci_probe()
2890 return -ENODEV; in parport_pc_pci_probe()
2907 irq = dev->irq; in parport_pc_pci_probe()
2910 id->vendor, id->device, io_lo, io_hi); in parport_pc_pci_probe()
2914 id->vendor, id->device, io_lo, io_hi, irq); in parport_pc_pci_probe()
2916 data->ports[count] = in parport_pc_pci_probe()
2918 PARPORT_DMA_NONE, &dev->dev, in parport_pc_pci_probe()
2922 if (data->ports[count]) in parport_pc_pci_probe()
2926 data->num = count; in parport_pc_pci_probe()
2938 return -ENODEV; in parport_pc_pci_probe()
2947 for (i = data->num - 1; i >= 0; i--) in parport_pc_pci_remove()
2948 parport_pc_unregister_port(data->ports[i]); in parport_pc_pci_remove()
2969 if (id == NULL || id->driver_data >= last_sio) in parport_pc_init_superio()
2972 if (parport_pc_superio_info[id->driver_data].probe( in parport_pc_init_superio()
2974 parport_pc_superio_info[id->driver_data].via)) { in parport_pc_init_superio()
3012 return -EINVAL; in parport_pc_pnp_probe()
3032 dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); in parport_pc_pnp_probe()
3033 pdata = parport_pc_probe_port(io_lo, io_hi, irq, dma, &dev->dev, 0); in parport_pc_pnp_probe()
3035 return -ENODEV; in parport_pc_pnp_probe()
3094 * is important here -- we want ISA ports to be registered first,
3096 * to do chipset-specific tests for some onboard ports that we know
3143 [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE
3146 [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY
3167 return -1; in parport_parse_param()
3219 MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
3358 return -EINVAL; in parport_pc_init()
3396 port = priv->port; in parport_pc_exit()
3397 dev = port->dev; in parport_pc_exit()
3399 if (dev && dev->bus == &platform_bus_type) in parport_pc_exit()
3405 MODULE_DESCRIPTION("PC-style parallel port driver");