Lines Matching refs:pb
106 static void frob_econtrol(struct parport *pb, unsigned char m, in frob_econtrol() argument
109 const struct parport_pc_private *priv = pb->physport->private_data; in frob_econtrol()
115 ectr = inb(ECONTROL(pb)); in frob_econtrol()
124 outb(new, ECONTROL(pb)); in frob_econtrol()
208 static int clear_epp_timeout(struct parport *pb) in clear_epp_timeout() argument
212 if (!(parport_pc_read_status(pb) & 0x01)) in clear_epp_timeout()
216 parport_pc_read_status(pb); in clear_epp_timeout()
217 r = parport_pc_read_status(pb); in clear_epp_timeout()
218 outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */ in clear_epp_timeout()
219 outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */ in clear_epp_timeout()
220 r = parport_pc_read_status(pb); in clear_epp_timeout()
1416 static int parport_SPP_supported(struct parport *pb) in parport_SPP_supported() argument
1426 clear_epp_timeout(pb); in parport_SPP_supported()
1430 outb(w, CONTROL(pb)); in parport_SPP_supported()
1437 r = inb(CONTROL(pb)); in parport_SPP_supported()
1440 outb(w, CONTROL(pb)); in parport_SPP_supported()
1441 r = inb(CONTROL(pb)); in parport_SPP_supported()
1442 outb(0xc, CONTROL(pb)); in parport_SPP_supported()
1451 pb->base, w, r); in parport_SPP_supported()
1456 parport_pc_write_data(pb, w); in parport_SPP_supported()
1457 r = parport_pc_read_data(pb); in parport_SPP_supported()
1460 parport_pc_write_data(pb, w); in parport_SPP_supported()
1461 r = parport_pc_read_data(pb); in parport_SPP_supported()
1470 pb->base, w, r); in parport_SPP_supported()
1472 pb->base); in parport_SPP_supported()
1496 static int parport_ECR_present(struct parport *pb) in parport_ECR_present() argument
1498 struct parport_pc_private *priv = pb->private_data; in parport_ECR_present()
1502 outb(r, CONTROL(pb)); in parport_ECR_present()
1503 if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { in parport_ECR_present()
1504 outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ in parport_ECR_present()
1506 r = inb(CONTROL(pb)); in parport_ECR_present()
1507 if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) in parport_ECR_present()
1512 if ((inb(ECONTROL(pb)) & 0x3) != 0x1) in parport_ECR_present()
1515 ECR_WRITE(pb, 0x34); in parport_ECR_present()
1516 if (inb(ECONTROL(pb)) != 0x35) in parport_ECR_present()
1521 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1524 frob_set_mode(pb, ECR_SPP); in parport_ECR_present()
1529 outb(0xc, CONTROL(pb)); in parport_ECR_present()
1551 static int parport_PS2_supported(struct parport *pb) in parport_PS2_supported() argument
1555 clear_epp_timeout(pb); in parport_PS2_supported()
1558 parport_pc_data_reverse(pb); in parport_PS2_supported()
1560 parport_pc_write_data(pb, 0x55); in parport_PS2_supported()
1561 if (parport_pc_read_data(pb) != 0x55) in parport_PS2_supported()
1564 parport_pc_write_data(pb, 0xaa); in parport_PS2_supported()
1565 if (parport_pc_read_data(pb) != 0xaa) in parport_PS2_supported()
1569 parport_pc_data_forward(pb); 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()
1582 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
1587 struct parport_pc_private *priv = pb->private_data; in parport_ECP_supported()
1596 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1597 ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */ in parport_ECP_supported()
1598 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++) in parport_ECP_supported()
1599 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1606 ECR_WRITE(pb, ECR_SPP << 5); in parport_ECP_supported()
1612 printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); in parport_ECP_supported()
1615 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1616 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1618 inb(FIFO(pb)); in parport_ECP_supported()
1620 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1627 pb->base, i); in parport_ECP_supported()
1636 frob_set_mode(pb, ECR_PS2); /* Reset FIFO and enable PS2 */ in parport_ECP_supported()
1637 parport_pc_data_reverse(pb); /* Must be in PS2 mode */ in parport_ECP_supported()
1638 frob_set_mode(pb, ECR_TST); /* Test FIFO */ in parport_ECP_supported()
1639 frob_econtrol(pb, 1<<2, 1<<2); in parport_ECP_supported()
1640 frob_econtrol(pb, 1<<2, 0); in parport_ECP_supported()
1642 outb(0xaa, FIFO(pb)); in parport_ECP_supported()
1643 if (inb(ECONTROL(pb)) & (1<<2)) in parport_ECP_supported()
1650 pb->base, i); in parport_ECP_supported()
1657 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in parport_ECP_supported()
1658 ECR_WRITE(pb, 0xf4); /* Configuration mode */ in parport_ECP_supported()
1659 config = inb(CONFIGA(pb)); 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()
1680 pb->base, 8 * pword); in parport_ECP_supported()
1683 pb->base, config & 0x80 ? "Level" : "Pulses"); in parport_ECP_supported()
1685 configb = inb(CONFIGB(pb)); 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()
1701 frob_set_mode(pb, ECR_SPP); in parport_ECP_supported()
1708 static int intel_bug_present_check_epp(struct parport *pb) in intel_bug_present_check_epp() argument
1710 const struct parport_pc_private *priv = pb->private_data; in intel_bug_present_check_epp()
1715 unsigned char ecr = inb(ECONTROL(pb)); in intel_bug_present_check_epp()
1718 ECR_WRITE(pb, i); in intel_bug_present_check_epp()
1719 if (clear_epp_timeout(pb)) { in intel_bug_present_check_epp()
1726 ECR_WRITE(pb, ecr); in intel_bug_present_check_epp()
1731 static int intel_bug_present(struct parport *pb) in intel_bug_present() argument
1734 if (pb->dev != NULL) { in intel_bug_present()
1738 return intel_bug_present_check_epp(pb); in intel_bug_present()
1741 static int intel_bug_present(struct parport *pb) in intel_bug_present() argument
1747 static int parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
1749 const struct parport_pc_private *priv = pb->private_data; in parport_ECPPS2_supported()
1756 oecr = inb(ECONTROL(pb)); in parport_ECPPS2_supported()
1757 ECR_WRITE(pb, ECR_PS2 << 5); in parport_ECPPS2_supported()
1758 result = parport_PS2_supported(pb); in parport_ECPPS2_supported()
1759 ECR_WRITE(pb, oecr); in parport_ECPPS2_supported()
1765 static int parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
1781 if (!clear_epp_timeout(pb)) in parport_EPP_supported()
1785 if (intel_bug_present(pb)) in parport_EPP_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()
1799 static int parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
1801 struct parport_pc_private *priv = pb->private_data; in parport_ECPEPP_supported()
1808 oecr = inb(ECONTROL(pb)); in parport_ECPEPP_supported()
1810 ECR_WRITE(pb, 0x80); in parport_ECPEPP_supported()
1811 outb(0x04, CONTROL(pb)); in parport_ECPEPP_supported()
1812 result = parport_EPP_supported(pb); in parport_ECPEPP_supported()
1814 ECR_WRITE(pb, oecr); 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()
1830 static int parport_PS2_supported(struct parport *pb) { return 0; } in parport_PS2_supported() argument
1832 static int parport_ECP_supported(struct parport *pb) in parport_ECP_supported() argument
1837 static int parport_EPP_supported(struct parport *pb) in parport_EPP_supported() argument
1842 static int parport_ECPEPP_supported(struct parport *pb) in parport_ECPEPP_supported() argument
1847 static int parport_ECPPS2_supported(struct parport *pb) in parport_ECPPS2_supported() argument
1857 static int programmable_irq_support(struct parport *pb) in programmable_irq_support() argument
1860 unsigned char oecr = inb(ECONTROL(pb)); in programmable_irq_support()
1865 ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */ in programmable_irq_support()
1867 intrLine = (inb(CONFIGB(pb)) >> 3) & 0x07; in programmable_irq_support()
1870 ECR_WRITE(pb, oecr); in programmable_irq_support()
1874 static int irq_probe_ECP(struct parport *pb) in irq_probe_ECP() argument
1881 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ in irq_probe_ECP()
1882 ECR_WRITE(pb, (ECR_TST << 5) | 0x04); in irq_probe_ECP()
1883 ECR_WRITE(pb, ECR_TST << 5); in irq_probe_ECP()
1886 for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++) in irq_probe_ECP()
1887 outb(0xaa, FIFO(pb)); in irq_probe_ECP()
1889 pb->irq = probe_irq_off(irqs); in irq_probe_ECP()
1890 ECR_WRITE(pb, ECR_SPP << 5); 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()
1902 static int irq_probe_EPP(struct parport *pb) in irq_probe_EPP() argument
1910 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1911 oecr = inb(ECONTROL(pb)); in irq_probe_EPP()
1915 if (pb->modes & PARPORT_MODE_PCECR) in irq_probe_EPP()
1916 frob_econtrol(pb, 0x10, 0x10); in irq_probe_EPP()
1918 clear_epp_timeout(pb); in irq_probe_EPP()
1919 parport_pc_frob_control(pb, 0x20, 0x20); in irq_probe_EPP()
1920 parport_pc_frob_control(pb, 0x10, 0x10); in irq_probe_EPP()
1921 clear_epp_timeout(pb); in irq_probe_EPP()
1926 parport_pc_read_epp(pb); 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()
1931 ECR_WRITE(pb, oecr); in irq_probe_EPP()
1932 parport_pc_write_control(pb, 0xc); 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()
1941 static int irq_probe_SPP(struct parport *pb) in irq_probe_SPP() argument
1954 static int parport_irq_probe(struct parport *pb) in parport_irq_probe() argument
1956 struct parport_pc_private *priv = pb->private_data; 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()
1969 clear_epp_timeout(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()
1974 clear_epp_timeout(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()