Lines Matching full:pb
106 static void frob_econtrol(struct parport *pb, unsigned char m, in frob_econtrol() argument
112 ectr = inb(ECONTROL(pb)); in frob_econtrol()
117 outb((ectr & ~m) ^ v, ECONTROL(pb)); in frob_econtrol()
201 static int clear_epp_timeout(struct parport *pb) in clear_epp_timeout() argument
205 if (!(parport_pc_read_status(pb) & 0x01)) in clear_epp_timeout()
209 parport_pc_read_status(pb); in clear_epp_timeout()
210 r = parport_pc_read_status(pb); in clear_epp_timeout()
211 outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */ in clear_epp_timeout()
212 outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */ in clear_epp_timeout()
213 r = parport_pc_read_status(pb); in clear_epp_timeout()
1397 static int parport_SPP_supported(struct parport *pb) in parport_SPP_supported() argument
1407 clear_epp_timeout(pb); in parport_SPP_supported()
1411 outb(w, CONTROL(pb)); in parport_SPP_supported()
1418 r = inb(CONTROL(pb)); in parport_SPP_supported()
1421 outb(w, CONTROL(pb)); in parport_SPP_supported()
1422 r = inb(CONTROL(pb)); in parport_SPP_supported()
1423 outb(0xc, CONTROL(pb)); in parport_SPP_supported()
1432 pb->base, w, r); in parport_SPP_supported()
1437 parport_pc_write_data(pb, w); in parport_SPP_supported()
1438 r = parport_pc_read_data(pb); in parport_SPP_supported()
1441 parport_pc_write_data(pb, w); in parport_SPP_supported()
1442 r = parport_pc_read_data(pb); in parport_SPP_supported()
1451 pb->base, w, r); in parport_SPP_supported()
1453 pb->base); in parport_SPP_supported()
1477 static int parport_ECR_present(struct parport *pb) in parport_ECR_present() argument
1479 struct parport_pc_private *priv = pb->private_data; in parport_ECR_present()
1482 outb(r, CONTROL(pb)); in parport_ECR_present()
1483 if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { in parport_ECR_present()
1484 outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ in parport_ECR_present()
1486 r = inb(CONTROL(pb)); in parport_ECR_present()
1487 if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) in parport_ECR_present()
1491 if ((inb(ECONTROL(pb)) & 0x3) != 0x1) in parport_ECR_present()
1494 ECR_WRITE(pb, 0x34); in parport_ECR_present()
1495 if (inb(ECONTROL(pb)) != 0x35) in parport_ECR_present()
1499 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1502 frob_set_mode(pb, ECR_SPP); in parport_ECR_present()
1507 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1529 static int parport_PS2_supported(struct parport *pb) in parport_PS2_supported() argument
1533 clear_epp_timeout(pb); in parport_PS2_supported()
1536 parport_pc_data_reverse(pb); in parport_PS2_supported()
1538 parport_pc_write_data(pb, 0x55); in parport_PS2_supported()
1539 if (parport_pc_read_data(pb) != 0x55) in parport_PS2_supported()
1542 parport_pc_write_data(pb, 0xaa); in parport_PS2_supported()
1543 if (parport_pc_read_data(pb) != 0xaa) in parport_PS2_supported()
1547 parport_pc_data_forward(pb); in parport_PS2_supported()
1550 pb->modes |= PARPORT_MODE_TRISTATE; in parport_PS2_supported()
1552 struct parport_pc_private *priv = pb->private_data; in parport_PS2_supported()
1560 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
1565 struct parport_pc_private *priv = pb->private_data; in parport_ECP_supported()
1574 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1575 ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */ in parport_ECP_supported()
1576 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++) in parport_ECP_supported()
1577 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1584 ECR_WRITE(pb, ECR_SPP << 5); in parport_ECP_supported()
1590 printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); in parport_ECP_supported()
1593 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1594 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1596 inb(FIFO(pb)); in parport_ECP_supported()
1598 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1605 pb->base, i); in parport_ECP_supported()
1614 frob_set_mode(pb, ECR_PS2); /* Reset FIFO and enable PS2 */ in parport_ECP_supported()
1615 parport_pc_data_reverse(pb); /* Must be in PS2 mode */ in parport_ECP_supported()
1616 frob_set_mode(pb, ECR_TST); /* Test FIFO */ in parport_ECP_supported()
1617 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1618 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1620 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1621 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1628 pb->base, i); in parport_ECP_supported()
1635 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1636 ECR_WRITE(pb, 0xf4); /* Configuration mode */ in parport_ECP_supported()
1637 config = inb(CONFIGA(pb)); in parport_ECP_supported()
1642 pr_warn("0x%lx: Unsupported pword size!\n", pb->base); in parport_ECP_supported()
1646 pr_warn("0x%lx: Unsupported pword size!\n", pb->base); in parport_ECP_supported()
1649 pr_warn("0x%lx: Unknown implementation ID\n", pb->base); in parport_ECP_supported()
1658 pb->base, 8 * pword); in parport_ECP_supported()
1661 pb->base, config & 0x80 ? "Level" : "Pulses"); in parport_ECP_supported()
1663 configb = inb(CONFIGB(pb)); in parport_ECP_supported()
1665 pb->base, config, configb); in parport_ECP_supported()
1666 printk(KERN_DEBUG "0x%lx: ECP settings irq=", pb->base); in parport_ECP_supported()
1679 frob_set_mode(pb, ECR_SPP); in parport_ECP_supported()
1686 static int intel_bug_present_check_epp(struct parport *pb) in intel_bug_present_check_epp() argument
1688 const struct parport_pc_private *priv = pb->private_data; in intel_bug_present_check_epp()
1693 unsigned char ecr = inb(ECONTROL(pb)); in intel_bug_present_check_epp()
1696 ECR_WRITE(pb, i); in intel_bug_present_check_epp()
1697 if (clear_epp_timeout(pb)) { in intel_bug_present_check_epp()
1704 ECR_WRITE(pb, ecr); in intel_bug_present_check_epp()
1709 static int intel_bug_present(struct parport *pb) in intel_bug_present() argument
1712 if (pb->dev != NULL) { in intel_bug_present()
1716 return intel_bug_present_check_epp(pb); in intel_bug_present()
1719 static int intel_bug_present(struct parport *pb) in intel_bug_present() argument
1725 static int parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
1727 const struct parport_pc_private *priv = pb->private_data; in parport_ECPPS2_supported()
1734 oecr = inb(ECONTROL(pb)); in parport_ECPPS2_supported()
1735 ECR_WRITE(pb, ECR_PS2 << 5); in parport_ECPPS2_supported()
1736 result = parport_PS2_supported(pb); in parport_ECPPS2_supported()
1737 ECR_WRITE(pb, oecr); in parport_ECPPS2_supported()
1743 static int parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
1759 if (!clear_epp_timeout(pb)) in parport_EPP_supported()
1763 if (intel_bug_present(pb)) in parport_EPP_supported()
1766 pb->modes |= PARPORT_MODE_EPP; in parport_EPP_supported()
1769 pb->ops->epp_read_data = parport_pc_epp_read_data; in parport_EPP_supported()
1770 pb->ops->epp_write_data = parport_pc_epp_write_data; in parport_EPP_supported()
1771 pb->ops->epp_read_addr = parport_pc_epp_read_addr; in parport_EPP_supported()
1772 pb->ops->epp_write_addr = parport_pc_epp_write_addr; in parport_EPP_supported()
1777 static int parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
1779 struct parport_pc_private *priv = pb->private_data; in parport_ECPEPP_supported()
1786 oecr = inb(ECONTROL(pb)); in parport_ECPEPP_supported()
1788 ECR_WRITE(pb, 0x80); in parport_ECPEPP_supported()
1789 outb(0x04, CONTROL(pb)); in parport_ECPEPP_supported()
1790 result = parport_EPP_supported(pb); in parport_ECPEPP_supported()
1792 ECR_WRITE(pb, oecr); in parport_ECPEPP_supported()
1796 pb->ops->epp_read_data = parport_pc_ecpepp_read_data; in parport_ECPEPP_supported()
1797 pb->ops->epp_write_data = parport_pc_ecpepp_write_data; in parport_ECPEPP_supported()
1798 pb->ops->epp_read_addr = parport_pc_ecpepp_read_addr; in parport_ECPEPP_supported()
1799 pb->ops->epp_write_addr = parport_pc_ecpepp_write_addr; in parport_ECPEPP_supported()
1808 static int parport_PS2_supported(struct parport *pb) { return 0; } in parport_PS2_supported() argument
1810 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
1815 static int parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
1820 static int parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
1825 static int parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
1835 static int programmable_irq_support(struct parport *pb) in programmable_irq_support() argument
1838 unsigned char oecr = inb(ECONTROL(pb)); in programmable_irq_support()
1843 ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */ in programmable_irq_support()
1845 intrLine = (inb(CONFIGB(pb)) >> 3) & 0x07; in programmable_irq_support()
1848 ECR_WRITE(pb, oecr); in programmable_irq_support()
1852 static int irq_probe_ECP(struct parport *pb) in irq_probe_ECP() argument
1859 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in irq_probe_ECP()
1860 ECR_WRITE(pb, (ECR_TST << 5) | 0x04); in irq_probe_ECP()
1861 ECR_WRITE(pb, ECR_TST << 5); in irq_probe_ECP()
1864 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++) in irq_probe_ECP()
1865 outb(0xaa, FIFO(pb)); in irq_probe_ECP()
1867 pb->irq = probe_irq_off(irqs); in irq_probe_ECP()
1868 ECR_WRITE(pb, ECR_SPP << 5); in irq_probe_ECP()
1870 if (pb->irq <= 0) in irq_probe_ECP()
1871 pb->irq = PARPORT_IRQ_NONE; in irq_probe_ECP()
1873 return pb->irq; in irq_probe_ECP()
1880 static int irq_probe_EPP(struct parport *pb) in irq_probe_EPP() argument
1888 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1889 oecr = inb(ECONTROL(pb)); in irq_probe_EPP()
1893 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1894 frob_econtrol(pb, 0x10, 0x10); in irq_probe_EPP()
1896 clear_epp_timeout(pb); in irq_probe_EPP()
1897 parport_pc_frob_control(pb, 0x20, 0x20); in irq_probe_EPP()
1898 parport_pc_frob_control(pb, 0x10, 0x10); in irq_probe_EPP()
1899 clear_epp_timeout(pb); in irq_probe_EPP()
1904 parport_pc_read_epp(pb); in irq_probe_EPP()
1907 pb->irq = probe_irq_off(irqs); in irq_probe_EPP()
1908 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1909 ECR_WRITE(pb, oecr); in irq_probe_EPP()
1910 parport_pc_write_control(pb, 0xc); in irq_probe_EPP()
1912 if (pb->irq <= 0) in irq_probe_EPP()
1913 pb->irq = PARPORT_IRQ_NONE; in irq_probe_EPP()
1915 return pb->irq; in irq_probe_EPP()
1919 static int irq_probe_SPP(struct parport *pb) in irq_probe_SPP() argument
1932 static int parport_irq_probe(struct parport *pb) in parport_irq_probe() argument
1934 struct parport_pc_private *priv = pb->private_data; in parport_irq_probe()
1937 pb->irq = programmable_irq_support(pb); in parport_irq_probe()
1939 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1940 pb->irq = irq_probe_ECP(pb); in parport_irq_probe()
1943 if ((pb->irq == PARPORT_IRQ_NONE) && priv->ecr && in parport_irq_probe()
1944 (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
1945 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
1947 clear_epp_timeout(pb); in parport_irq_probe()
1949 if (pb->irq == PARPORT_IRQ_NONE && (pb->modes & PARPORT_MODE_EPP)) in parport_irq_probe()
1950 pb->irq = irq_probe_EPP(pb); in parport_irq_probe()
1952 clear_epp_timeout(pb); in parport_irq_probe()
1954 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1955 pb->irq = irq_probe_SPP(pb); in parport_irq_probe()
1957 if (pb->irq == PARPORT_IRQ_NONE) in parport_irq_probe()
1958 pb->irq = get_superio_irq(pb); in parport_irq_probe()
1960 return pb->irq; in parport_irq_probe()