Lines Matching refs:pb

112 static void frob_econtrol(struct parport *pb, unsigned char m,  in frob_econtrol()  argument
118 ectr = inb(ECONTROL(pb)); in frob_econtrol()
123 outb((ectr & ~m) ^ v, ECONTROL(pb)); in frob_econtrol()
255 static int clear_epp_timeout(struct parport *pb) in clear_epp_timeout() argument
259 if (!(parport_pc_read_status(pb) & 0x01)) in clear_epp_timeout()
263 parport_pc_read_status(pb); in clear_epp_timeout()
264 r = parport_pc_read_status(pb); in clear_epp_timeout()
265 outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */ in clear_epp_timeout()
266 outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */ in clear_epp_timeout()
267 r = parport_pc_read_status(pb); in clear_epp_timeout()
1690 static int parport_SPP_supported(struct parport *pb) in parport_SPP_supported() argument
1700 clear_epp_timeout(pb); in parport_SPP_supported()
1704 outb(w, CONTROL(pb)); in parport_SPP_supported()
1711 r = inb(CONTROL(pb)); in parport_SPP_supported()
1714 outb(w, CONTROL(pb)); in parport_SPP_supported()
1715 r = inb(CONTROL(pb)); in parport_SPP_supported()
1716 outb(0xc, CONTROL(pb)); in parport_SPP_supported()
1725 "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); in parport_SPP_supported()
1730 parport_pc_write_data(pb, w); in parport_SPP_supported()
1731 r = parport_pc_read_data(pb); in parport_SPP_supported()
1734 parport_pc_write_data(pb, w); in parport_SPP_supported()
1735 r = parport_pc_read_data(pb); in parport_SPP_supported()
1744 "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); in parport_SPP_supported()
1747 pb->base); in parport_SPP_supported()
1771 static int parport_ECR_present(struct parport *pb) in parport_ECR_present() argument
1773 struct parport_pc_private *priv = pb->private_data; in parport_ECR_present()
1776 outb(r, CONTROL(pb)); in parport_ECR_present()
1777 if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { in parport_ECR_present()
1778 outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ in parport_ECR_present()
1780 r = inb(CONTROL(pb)); in parport_ECR_present()
1781 if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) in parport_ECR_present()
1785 if ((inb(ECONTROL(pb)) & 0x3) != 0x1) in parport_ECR_present()
1788 ECR_WRITE(pb, 0x34); in parport_ECR_present()
1789 if (inb(ECONTROL(pb)) != 0x35) in parport_ECR_present()
1793 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1796 frob_set_mode(pb, ECR_SPP); in parport_ECR_present()
1801 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1823 static int parport_PS2_supported(struct parport *pb) in parport_PS2_supported() argument
1827 clear_epp_timeout(pb); in parport_PS2_supported()
1830 parport_pc_data_reverse(pb); in parport_PS2_supported()
1832 parport_pc_write_data(pb, 0x55); in parport_PS2_supported()
1833 if (parport_pc_read_data(pb) != 0x55) in parport_PS2_supported()
1836 parport_pc_write_data(pb, 0xaa); in parport_PS2_supported()
1837 if (parport_pc_read_data(pb) != 0xaa) in parport_PS2_supported()
1841 parport_pc_data_forward(pb); in parport_PS2_supported()
1844 pb->modes |= PARPORT_MODE_TRISTATE; in parport_PS2_supported()
1846 struct parport_pc_private *priv = pb->private_data; in parport_PS2_supported()
1854 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
1859 struct parport_pc_private *priv = pb->private_data; in parport_ECP_supported()
1868 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1869 ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */ in parport_ECP_supported()
1870 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++) in parport_ECP_supported()
1871 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1878 ECR_WRITE(pb, ECR_SPP << 5); in parport_ECP_supported()
1884 printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); in parport_ECP_supported()
1887 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1888 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1890 inb(FIFO(pb)); in parport_ECP_supported()
1892 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1899 pb->base, i); in parport_ECP_supported()
1908 frob_set_mode(pb, ECR_PS2); /* Reset FIFO and enable PS2 */ in parport_ECP_supported()
1909 parport_pc_data_reverse(pb); /* Must be in PS2 mode */ in parport_ECP_supported()
1910 frob_set_mode(pb, ECR_TST); /* Test FIFO */ in parport_ECP_supported()
1911 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1912 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1914 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1915 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1922 pb->base, i); in parport_ECP_supported()
1929 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1930 ECR_WRITE(pb, 0xf4); /* Configuration mode */ in parport_ECP_supported()
1931 config = inb(CONFIGA(pb)); in parport_ECP_supported()
1937 pb->base); in parport_ECP_supported()
1942 pb->base); in parport_ECP_supported()
1946 pb->base); in parport_ECP_supported()
1955 pb->base, 8 * pword); in parport_ECP_supported()
1957 printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base, in parport_ECP_supported()
1960 configb = inb(CONFIGB(pb)); in parport_ECP_supported()
1962 pb->base, config, configb); in parport_ECP_supported()
1963 printk(KERN_DEBUG "0x%lx: ECP settings irq=", pb->base); in parport_ECP_supported()
1976 frob_set_mode(pb, ECR_SPP); in parport_ECP_supported()
1982 static int parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
1984 const struct parport_pc_private *priv = pb->private_data; in parport_ECPPS2_supported()
1991 oecr = inb(ECONTROL(pb)); in parport_ECPPS2_supported()
1992 ECR_WRITE(pb, ECR_PS2 << 5); in parport_ECPPS2_supported()
1993 result = parport_PS2_supported(pb); in parport_ECPPS2_supported()
1994 ECR_WRITE(pb, oecr); in parport_ECPPS2_supported()
2000 static int parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
2002 const struct parport_pc_private *priv = pb->private_data; in parport_EPP_supported()
2018 if (!clear_epp_timeout(pb)) in parport_EPP_supported()
2025 ECR_WRITE(pb, i); in parport_EPP_supported()
2026 if (clear_epp_timeout(pb)) { in parport_EPP_supported()
2033 pb->modes |= PARPORT_MODE_EPP; in parport_EPP_supported()
2036 pb->ops->epp_read_data = parport_pc_epp_read_data; in parport_EPP_supported()
2037 pb->ops->epp_write_data = parport_pc_epp_write_data; in parport_EPP_supported()
2038 pb->ops->epp_read_addr = parport_pc_epp_read_addr; in parport_EPP_supported()
2039 pb->ops->epp_write_addr = parport_pc_epp_write_addr; in parport_EPP_supported()
2044 static int parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
2046 struct parport_pc_private *priv = pb->private_data; in parport_ECPEPP_supported()
2053 oecr = inb(ECONTROL(pb)); in parport_ECPEPP_supported()
2055 ECR_WRITE(pb, 0x80); in parport_ECPEPP_supported()
2056 outb(0x04, CONTROL(pb)); in parport_ECPEPP_supported()
2057 result = parport_EPP_supported(pb); in parport_ECPEPP_supported()
2059 ECR_WRITE(pb, oecr); in parport_ECPEPP_supported()
2063 pb->ops->epp_read_data = parport_pc_ecpepp_read_data; in parport_ECPEPP_supported()
2064 pb->ops->epp_write_data = parport_pc_ecpepp_write_data; in parport_ECPEPP_supported()
2065 pb->ops->epp_read_addr = parport_pc_ecpepp_read_addr; in parport_ECPEPP_supported()
2066 pb->ops->epp_write_addr = parport_pc_ecpepp_write_addr; in parport_ECPEPP_supported()
2075 static int __devinit parport_PS2_supported(struct parport *pb) { return 0; } in parport_PS2_supported() argument
2077 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
2082 static int __devinit parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
2087 static int __devinit parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
2092 static int __devinit parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
2102 static int programmable_irq_support(struct parport *pb) in programmable_irq_support() argument
2105 unsigned char oecr = inb(ECONTROL(pb)); in programmable_irq_support()
2110 ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */ in programmable_irq_support()
2112 intrLine = (inb(CONFIGB(pb)) >> 3) & 0x07; in programmable_irq_support()
2115 ECR_WRITE(pb, oecr); in programmable_irq_support()
2119 static int irq_probe_ECP(struct parport *pb) in irq_probe_ECP() argument
2126 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in irq_probe_ECP()
2127 ECR_WRITE(pb, (ECR_TST << 5) | 0x04); in irq_probe_ECP()
2128 ECR_WRITE(pb, ECR_TST << 5); in irq_probe_ECP()
2131 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++) in irq_probe_ECP()
2132 outb(0xaa, FIFO(pb)); in irq_probe_ECP()
2134 pb->irq = probe_irq_off(irqs); in irq_probe_ECP()
2135 ECR_WRITE(pb, ECR_SPP << 5); in irq_probe_ECP()
2137 if (pb->irq <= 0) in irq_probe_ECP()
2138 pb->irq = PARPORT_IRQ_NONE; in irq_probe_ECP()
2140 return pb->irq; in irq_probe_ECP()
2147 static int irq_probe_EPP(struct parport *pb) in irq_probe_EPP() argument
2155 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
2156 oecr = inb(ECONTROL(pb)); in irq_probe_EPP()
2160 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
2161 frob_econtrol(pb, 0x10, 0x10); in irq_probe_EPP()
2163 clear_epp_timeout(pb); in irq_probe_EPP()
2164 parport_pc_frob_control(pb, 0x20, 0x20); in irq_probe_EPP()
2165 parport_pc_frob_control(pb, 0x10, 0x10); in irq_probe_EPP()
2166 clear_epp_timeout(pb); in irq_probe_EPP()
2171 parport_pc_read_epp(pb); in irq_probe_EPP()
2174 pb->irq = probe_irq_off(irqs); in irq_probe_EPP()
2175 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
2176 ECR_WRITE(pb, oecr); in irq_probe_EPP()
2177 parport_pc_write_control(pb, 0xc); in irq_probe_EPP()
2179 if (pb->irq <= 0) in irq_probe_EPP()
2180 pb->irq = PARPORT_IRQ_NONE; in irq_probe_EPP()
2182 return pb->irq; in irq_probe_EPP()
2186 static int irq_probe_SPP(struct parport *pb) in irq_probe_SPP() argument
2199 static int parport_irq_probe(struct parport *pb) in parport_irq_probe() argument
2201 struct parport_pc_private *priv = pb->private_data; in parport_irq_probe()
2204 pb->irq = programmable_irq_support(pb); in parport_irq_probe()
2206 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
2207 pb->irq = irq_probe_ECP(pb); in parport_irq_probe()
2210 if ((pb->irq == PARPORT_IRQ_NONE) && priv->ecr && in parport_irq_probe()
2211 (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
2212 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
2214 clear_epp_timeout(pb); in parport_irq_probe()
2216 if (pb->irq == PARPORT_IRQ_NONE && (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
2217 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
2219 clear_epp_timeout(pb); in parport_irq_probe()
2221 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
2222 pb->irq = irq_probe_SPP(pb); in parport_irq_probe()
2224 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
2225 pb->irq = get_superio_irq(pb); in parport_irq_probe()
2227 return pb->irq; in parport_irq_probe()