aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_jmicron.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-11-19 04:06:11 -0500
committerJeff Garzik <jeff@garzik.org>2007-11-23 19:23:55 -0500
commit0706efd61edfcf958c2c19669aa65c2180ec3ba0 (patch)
tree9accc045719661b364158cd1c3ca51bcad035678 /drivers/ata/pata_jmicron.c
parentdd05c199cd02ffd2ac49eb29677f1468910996a8 (diff)
pata_jmicron: fix disabled port handling in jmicron_pre_reset()
There are two bugs in disabled port handling. * test in PORT_PATA0 is reversed * ->prereset should return -ENOENT for disabled ports not 0 The first bug makes the PATA channel considered disabled but the second bug saves the day by returning 0. The net result is that cable is always left at ATA_CBL_UNKNOWN. This results in false 80c configuration and thus transfer errors. This patch fixes both bugs. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_jmicron.c')
-rw-r--r--drivers/ata/pata_jmicron.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 225a7223a72..5b8174d9406 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
80 * actually do our cable checking etc. Thankfully we don't need 80 * actually do our cable checking etc. Thankfully we don't need
81 * to do the plumbing for other cases. 81 * to do the plumbing for other cases.
82 */ 82 */
83 switch (port_map[port]) 83 switch (port_map[port]) {
84 {
85 case PORT_PATA0: 84 case PORT_PATA0:
86 if (control & (1 << 5)) 85 if ((control & (1 << 5)) == 0)
87 return 0; 86 return -ENOENT;
88 if (control & (1 << 3)) /* 40/80 pin primary */ 87 if (control & (1 << 3)) /* 40/80 pin primary */
89 ap->cbl = ATA_CBL_PATA40; 88 ap->cbl = ATA_CBL_PATA40;
90 else 89 else
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
93 case PORT_PATA1: 92 case PORT_PATA1:
94 /* Bit 21 is set if the port is enabled */ 93 /* Bit 21 is set if the port is enabled */
95 if ((control5 & (1 << 21)) == 0) 94 if ((control5 & (1 << 21)) == 0)
96 return 0; 95 return -ENOENT;
97 if (control5 & (1 << 19)) /* 40/80 pin secondary */ 96 if (control5 & (1 << 19)) /* 40/80 pin secondary */
98 ap->cbl = ATA_CBL_PATA40; 97 ap->cbl = ATA_CBL_PATA40;
99 else 98 else