diff options
author | Tejun Heo <htejun@gmail.com> | 2008-03-05 23:12:54 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-10 20:50:36 -0400 |
commit | f659f0e4480bb82e6dcf3db8ba1e8485444084e5 (patch) | |
tree | 23ede4117c50f6794628fe5084bfd91027be12e3 /drivers | |
parent | eec59f76e9010e22d5736cf1907af4a92067522e (diff) |
libata-sff: handle controllers w/o ctl register
SFF incorrectly assumed that ctl register is available for all
controllers while some old SFF controllers don't have ctl register.
Make SFF handle controllers w/o ctl register by conditionalizing ctl
register access and softreset method.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-sff.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 60cd4b179766..20dc572fb45a 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -56,7 +56,8 @@ u8 ata_irq_on(struct ata_port *ap) | |||
56 | ap->ctl &= ~ATA_NIEN; | 56 | ap->ctl &= ~ATA_NIEN; |
57 | ap->last_ctl = ap->ctl; | 57 | ap->last_ctl = ap->ctl; |
58 | 58 | ||
59 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 59 | if (ioaddr->ctl_addr) |
60 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
60 | tmp = ata_wait_idle(ap); | 61 | tmp = ata_wait_idle(ap); |
61 | 62 | ||
62 | ap->ops->irq_clear(ap); | 63 | ap->ops->irq_clear(ap); |
@@ -81,12 +82,14 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
81 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 82 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
82 | 83 | ||
83 | if (tf->ctl != ap->last_ctl) { | 84 | if (tf->ctl != ap->last_ctl) { |
84 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 85 | if (ioaddr->ctl_addr) |
86 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
85 | ap->last_ctl = tf->ctl; | 87 | ap->last_ctl = tf->ctl; |
86 | ata_wait_idle(ap); | 88 | ata_wait_idle(ap); |
87 | } | 89 | } |
88 | 90 | ||
89 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | 91 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { |
92 | WARN_ON(!ioaddr->ctl_addr); | ||
90 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | 93 | iowrite8(tf->hob_feature, ioaddr->feature_addr); |
91 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | 94 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); |
92 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | 95 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); |
@@ -167,14 +170,17 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
167 | tf->device = ioread8(ioaddr->device_addr); | 170 | tf->device = ioread8(ioaddr->device_addr); |
168 | 171 | ||
169 | if (tf->flags & ATA_TFLAG_LBA48) { | 172 | if (tf->flags & ATA_TFLAG_LBA48) { |
170 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); | 173 | if (likely(ioaddr->ctl_addr)) { |
171 | tf->hob_feature = ioread8(ioaddr->error_addr); | 174 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); |
172 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); | 175 | tf->hob_feature = ioread8(ioaddr->error_addr); |
173 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); | 176 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); |
174 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); | 177 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); |
175 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); | 178 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); |
176 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 179 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); |
177 | ap->last_ctl = tf->ctl; | 180 | iowrite8(tf->ctl, ioaddr->ctl_addr); |
181 | ap->last_ctl = tf->ctl; | ||
182 | } else | ||
183 | WARN_ON(1); | ||
178 | } | 184 | } |
179 | } | 185 | } |
180 | 186 | ||
@@ -352,7 +358,8 @@ void ata_bmdma_freeze(struct ata_port *ap) | |||
352 | ap->ctl |= ATA_NIEN; | 358 | ap->ctl |= ATA_NIEN; |
353 | ap->last_ctl = ap->ctl; | 359 | ap->last_ctl = ap->ctl; |
354 | 360 | ||
355 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 361 | if (ioaddr->ctl_addr) |
362 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
356 | 363 | ||
357 | /* Under certain circumstances, some controllers raise IRQ on | 364 | /* Under certain circumstances, some controllers raise IRQ on |
358 | * ATA_NIEN manipulation. Also, many controllers fail to mask | 365 | * ATA_NIEN manipulation. Also, many controllers fail to mask |
@@ -459,13 +466,14 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
459 | */ | 466 | */ |
460 | void ata_bmdma_error_handler(struct ata_port *ap) | 467 | void ata_bmdma_error_handler(struct ata_port *ap) |
461 | { | 468 | { |
462 | ata_reset_fn_t hardreset; | 469 | ata_reset_fn_t softreset = NULL, hardreset = NULL; |
463 | 470 | ||
464 | hardreset = NULL; | 471 | if (ap->ioaddr.ctl_addr) |
472 | softreset = ata_std_softreset; | ||
465 | if (sata_scr_valid(&ap->link)) | 473 | if (sata_scr_valid(&ap->link)) |
466 | hardreset = sata_std_hardreset; | 474 | hardreset = sata_std_hardreset; |
467 | 475 | ||
468 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, | 476 | ata_bmdma_drive_eh(ap, ata_std_prereset, softreset, hardreset, |
469 | ata_std_postreset); | 477 | ata_std_postreset); |
470 | } | 478 | } |
471 | 479 | ||