diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2011-10-11 13:56:03 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2011-10-14 13:07:52 -0400 |
commit | f4c6ae50209a4405b2b0bc99eb449060877eef42 (patch) | |
tree | 2add361b02d5eb0d53726ae13976dc3b58d57857 /drivers/ata/pata_cmd64x.c | |
parent | dc5e44ec6f75d493df484728587b00b87a233482 (diff) |
pata_cmd64x: add cmd64x_fixup()
Factor out common code from cmd64x_[re]init_one() to cmd64x_fixup().
Remove stale comment and fix a minor CodingStyle issue while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.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 | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 7bafc16cf5e0..b8f2a64bef7b 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -288,6 +288,22 @@ static struct ata_port_operations cmd648_port_ops = { | |||
288 | .cable_detect = cmd648_cable_detect, | 288 | .cable_detect = cmd648_cable_detect, |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static void cmd64x_fixup(struct pci_dev *pdev) | ||
292 | { | ||
293 | u8 mrdmode; | ||
294 | |||
295 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | ||
296 | pci_read_config_byte(pdev, MRDMODE, &mrdmode); | ||
297 | mrdmode &= ~0x30; /* IRQ set up */ | ||
298 | mrdmode |= 0x02; /* Memory read line enable */ | ||
299 | pci_write_config_byte(pdev, MRDMODE, mrdmode); | ||
300 | |||
301 | /* PPC specific fixup copied from old driver */ | ||
302 | #ifdef CONFIG_PPC | ||
303 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | ||
304 | #endif | ||
305 | } | ||
306 | |||
291 | static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 307 | static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
292 | { | 308 | { |
293 | static const struct ata_port_info cmd_info[6] = { | 309 | static const struct ata_port_info cmd_info[6] = { |
@@ -336,7 +352,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
336 | &cmd_info[id->driver_data], | 352 | &cmd_info[id->driver_data], |
337 | NULL | 353 | NULL |
338 | }; | 354 | }; |
339 | u8 mrdmode, reg; | 355 | u8 reg; |
340 | int rc; | 356 | int rc; |
341 | struct pci_dev *bridge = pdev->bus->self; | 357 | struct pci_dev *bridge = pdev->bus->self; |
342 | /* mobility split bridges don't report enabled ports correctly */ | 358 | /* mobility split bridges don't report enabled ports correctly */ |
@@ -368,11 +384,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
368 | cntrl_ch0_ok = 0; | 384 | cntrl_ch0_ok = 0; |
369 | } | 385 | } |
370 | 386 | ||
371 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | 387 | cmd64x_fixup(pdev); |
372 | pci_read_config_byte(pdev, MRDMODE, &mrdmode); | ||
373 | mrdmode &= ~ 0x30; /* IRQ set up */ | ||
374 | mrdmode |= 0x02; /* Memory read line enable */ | ||
375 | pci_write_config_byte(pdev, MRDMODE, mrdmode); | ||
376 | 388 | ||
377 | /* check for enabled ports */ | 389 | /* check for enabled ports */ |
378 | pci_read_config_byte(pdev, CNTRL, ®); | 390 | pci_read_config_byte(pdev, CNTRL, ®); |
@@ -388,13 +400,6 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
388 | ppi[1] = &ata_dummy_port_info; | 400 | ppi[1] = &ata_dummy_port_info; |
389 | } | 401 | } |
390 | 402 | ||
391 | /* Force PIO 0 here.. */ | ||
392 | |||
393 | /* PPC specific fixup copied from old driver */ | ||
394 | #ifdef CONFIG_PPC | ||
395 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | ||
396 | #endif | ||
397 | |||
398 | return ata_pci_bmdma_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); | 403 | return ata_pci_bmdma_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); |
399 | } | 404 | } |
400 | 405 | ||
@@ -402,21 +407,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
402 | static int cmd64x_reinit_one(struct pci_dev *pdev) | 407 | static int cmd64x_reinit_one(struct pci_dev *pdev) |
403 | { | 408 | { |
404 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 409 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
405 | u8 mrdmode; | ||
406 | int rc; | 410 | int rc; |
407 | 411 | ||
408 | rc = ata_pci_device_do_resume(pdev); | 412 | rc = ata_pci_device_do_resume(pdev); |
409 | if (rc) | 413 | if (rc) |
410 | return rc; | 414 | return rc; |
411 | 415 | ||
412 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | 416 | cmd64x_fixup(pdev); |
413 | pci_read_config_byte(pdev, MRDMODE, &mrdmode); | 417 | |
414 | mrdmode &= ~ 0x30; /* IRQ set up */ | ||
415 | mrdmode |= 0x02; /* Memory read line enable */ | ||
416 | pci_write_config_byte(pdev, MRDMODE, mrdmode); | ||
417 | #ifdef CONFIG_PPC | ||
418 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | ||
419 | #endif | ||
420 | ata_host_resume(host); | 418 | ata_host_resume(host); |
421 | return 0; | 419 | return 0; |
422 | } | 420 | } |