diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2012-03-11 15:28:18 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-03-13 16:43:11 -0400 |
commit | b8cec3c253a2a001e463c43260fb75fb3223a04d (patch) | |
tree | b9ff972412409aabe4f167484e1d818c14420c8e /drivers/ata/pata_cmd64x.c | |
parent | 419fd2461354f7675ef298fa26ffceff4d0b2168 (diff) |
pata_cmd64x: implement sff_irq_check() method
Implement sff_irq_check() method for both old and new chips.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_cmd64x.c')
-rw-r--r-- | drivers/ata/pata_cmd64x.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index d4f26a515ef8..1c17cd1e8b2d 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/libata.h> | 33 | #include <linux/libata.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata_cmd64x" | 35 | #define DRV_NAME "pata_cmd64x" |
36 | #define DRV_VERSION "0.2.17" | 36 | #define DRV_VERSION "0.2.18" |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * CMD64x specific registers definition. | 39 | * CMD64x specific registers definition. |
@@ -230,6 +230,26 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * cmd64x_sff_irq_check - check IDE interrupt | ||
234 | * @ap: ATA interface | ||
235 | * | ||
236 | * Check IDE interrupt in CFR/ARTTIM23 registers. | ||
237 | */ | ||
238 | |||
239 | static bool cmd64x_sff_irq_check(struct ata_port *ap) | ||
240 | { | ||
241 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
242 | int irq_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; | ||
243 | int irq_reg = ap->port_no ? ARTTIM23 : CFR; | ||
244 | u8 irq_stat; | ||
245 | |||
246 | /* NOTE: reading the register should clear the interrupt */ | ||
247 | pci_read_config_byte(pdev, irq_reg, &irq_stat); | ||
248 | |||
249 | return irq_stat & irq_mask; | ||
250 | } | ||
251 | |||
252 | /** | ||
233 | * cmd64x_sff_irq_clear - clear IDE interrupt | 253 | * cmd64x_sff_irq_clear - clear IDE interrupt |
234 | * @ap: ATA interface | 254 | * @ap: ATA interface |
235 | * | 255 | * |
@@ -249,6 +269,23 @@ static void cmd64x_sff_irq_clear(struct ata_port *ap) | |||
249 | } | 269 | } |
250 | 270 | ||
251 | /** | 271 | /** |
272 | * cmd648_sff_irq_check - check IDE interrupt | ||
273 | * @ap: ATA interface | ||
274 | * | ||
275 | * Check IDE interrupt in MRDMODE register. | ||
276 | */ | ||
277 | |||
278 | static bool cmd648_sff_irq_check(struct ata_port *ap) | ||
279 | { | ||
280 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
281 | unsigned long base = pci_resource_start(pdev, 4); | ||
282 | int irq_mask = ap->port_no ? MRDMODE_INTR_CH1 : MRDMODE_INTR_CH0; | ||
283 | u8 mrdmode = inb(base + 1); | ||
284 | |||
285 | return mrdmode & irq_mask; | ||
286 | } | ||
287 | |||
288 | /** | ||
252 | * cmd648_sff_irq_clear - clear IDE interrupt | 289 | * cmd648_sff_irq_clear - clear IDE interrupt |
253 | * @ap: ATA interface | 290 | * @ap: ATA interface |
254 | * | 291 | * |
@@ -294,12 +331,14 @@ static const struct ata_port_operations cmd64x_base_ops = { | |||
294 | 331 | ||
295 | static struct ata_port_operations cmd64x_port_ops = { | 332 | static struct ata_port_operations cmd64x_port_ops = { |
296 | .inherits = &cmd64x_base_ops, | 333 | .inherits = &cmd64x_base_ops, |
334 | .sff_irq_check = cmd64x_sff_irq_check, | ||
297 | .sff_irq_clear = cmd64x_sff_irq_clear, | 335 | .sff_irq_clear = cmd64x_sff_irq_clear, |
298 | .cable_detect = ata_cable_40wire, | 336 | .cable_detect = ata_cable_40wire, |
299 | }; | 337 | }; |
300 | 338 | ||
301 | static struct ata_port_operations cmd646r1_port_ops = { | 339 | static struct ata_port_operations cmd646r1_port_ops = { |
302 | .inherits = &cmd64x_base_ops, | 340 | .inherits = &cmd64x_base_ops, |
341 | .sff_irq_check = cmd64x_sff_irq_check, | ||
303 | .sff_irq_clear = cmd64x_sff_irq_clear, | 342 | .sff_irq_clear = cmd64x_sff_irq_clear, |
304 | .bmdma_stop = cmd646r1_bmdma_stop, | 343 | .bmdma_stop = cmd646r1_bmdma_stop, |
305 | .cable_detect = ata_cable_40wire, | 344 | .cable_detect = ata_cable_40wire, |
@@ -307,12 +346,14 @@ static struct ata_port_operations cmd646r1_port_ops = { | |||
307 | 346 | ||
308 | static struct ata_port_operations cmd646r3_port_ops = { | 347 | static struct ata_port_operations cmd646r3_port_ops = { |
309 | .inherits = &cmd64x_base_ops, | 348 | .inherits = &cmd64x_base_ops, |
349 | .sff_irq_check = cmd648_sff_irq_check, | ||
310 | .sff_irq_clear = cmd648_sff_irq_clear, | 350 | .sff_irq_clear = cmd648_sff_irq_clear, |
311 | .cable_detect = ata_cable_40wire, | 351 | .cable_detect = ata_cable_40wire, |
312 | }; | 352 | }; |
313 | 353 | ||
314 | static struct ata_port_operations cmd648_port_ops = { | 354 | static struct ata_port_operations cmd648_port_ops = { |
315 | .inherits = &cmd64x_base_ops, | 355 | .inherits = &cmd64x_base_ops, |
356 | .sff_irq_check = cmd648_sff_irq_check, | ||
316 | .sff_irq_clear = cmd648_sff_irq_clear, | 357 | .sff_irq_clear = cmd648_sff_irq_clear, |
317 | .cable_detect = cmd648_cable_detect, | 358 | .cable_detect = cmd648_cable_detect, |
318 | }; | 359 | }; |