diff options
Diffstat (limited to 'drivers/parport')
-rw-r--r-- | drivers/parport/parport_pc.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 76ee7750bc5e..fedc06bed18d 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -1702,6 +1702,30 @@ static int parport_ECP_supported(struct parport *pb) | |||
1702 | } | 1702 | } |
1703 | #endif | 1703 | #endif |
1704 | 1704 | ||
1705 | static int intel_bug_present(struct parport *pb) | ||
1706 | { | ||
1707 | const struct parport_pc_private *priv = pb->private_data; | ||
1708 | int bug_present = 0; | ||
1709 | |||
1710 | if (priv->ecr) { | ||
1711 | /* store value of ECR */ | ||
1712 | unsigned char ecr = inb(ECONTROL(pb)); | ||
1713 | unsigned char i; | ||
1714 | for (i = 0x00; i < 0x80; i += 0x20) { | ||
1715 | ECR_WRITE(pb, i); | ||
1716 | if (clear_epp_timeout(pb)) { | ||
1717 | /* Phony EPP in ECP. */ | ||
1718 | bug_present = 1; | ||
1719 | break; | ||
1720 | } | ||
1721 | } | ||
1722 | /* return ECR into the inital state */ | ||
1723 | ECR_WRITE(pb, ecr); | ||
1724 | } | ||
1725 | |||
1726 | return bug_present; | ||
1727 | } | ||
1728 | |||
1705 | static int parport_ECPPS2_supported(struct parport *pb) | 1729 | static int parport_ECPPS2_supported(struct parport *pb) |
1706 | { | 1730 | { |
1707 | const struct parport_pc_private *priv = pb->private_data; | 1731 | const struct parport_pc_private *priv = pb->private_data; |
@@ -1722,8 +1746,6 @@ static int parport_ECPPS2_supported(struct parport *pb) | |||
1722 | 1746 | ||
1723 | static int parport_EPP_supported(struct parport *pb) | 1747 | static int parport_EPP_supported(struct parport *pb) |
1724 | { | 1748 | { |
1725 | const struct parport_pc_private *priv = pb->private_data; | ||
1726 | |||
1727 | /* | 1749 | /* |
1728 | * Theory: | 1750 | * Theory: |
1729 | * Bit 0 of STR is the EPP timeout bit, this bit is 0 | 1751 | * Bit 0 of STR is the EPP timeout bit, this bit is 0 |
@@ -1742,16 +1764,8 @@ static int parport_EPP_supported(struct parport *pb) | |||
1742 | return 0; /* No way to clear timeout */ | 1764 | return 0; /* No way to clear timeout */ |
1743 | 1765 | ||
1744 | /* Check for Intel bug. */ | 1766 | /* Check for Intel bug. */ |
1745 | if (priv->ecr) { | 1767 | if (intel_bug_present(pb)) |
1746 | unsigned char i; | 1768 | return 0; |
1747 | for (i = 0x00; i < 0x80; i += 0x20) { | ||
1748 | ECR_WRITE(pb, i); | ||
1749 | if (clear_epp_timeout(pb)) { | ||
1750 | /* Phony EPP in ECP. */ | ||
1751 | return 0; | ||
1752 | } | ||
1753 | } | ||
1754 | } | ||
1755 | 1769 | ||
1756 | pb->modes |= PARPORT_MODE_EPP; | 1770 | pb->modes |= PARPORT_MODE_EPP; |
1757 | 1771 | ||