diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:51 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:51 -0400 |
commit | 88b2b32babd46cd54d2de4d17eb869aea3383e11 (patch) | |
tree | d446864f7c3431f8c428eecacd11caf7b794f018 /drivers/ide/pci/pdc202xx_new.c | |
parent | 6e249395eace037ef139a1c8996b31e3797e412a (diff) |
ide: move ide_config_drive_speed() calls to upper layers (take 2)
* Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16.
* Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program
the host for the transfer mode after programming the device. Set it
in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac
and via82cxxx host drivers.
* Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely
skip programming of host/device for the transfer mode ("smart" hosts).
Set it in it821x host driver and check it in ide_tune_dma().
* Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all
direct ->set_pio_mode/->speedproc users to use these helpers.
* Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc
methods to callers.
* Rename ->speedproc method to ->set_dma_mode, make it void and update
all implementations accordingly.
* Update ide_set_xfer_rate() comments.
* Unexport ide_config_drive_speed().
v2:
* Fix issues noticed by Sergei:
- export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt
to setting DMA modes from sc1200_set_pio_mode() to do_special()
- check IDE_HFLAG_NO_SET_MODE in ide_tune_dma()
- check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode()
- check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode()
- return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL
- don't set ->set_{pio,dma}_mode on it821x in "smart" mode
- fix build problem in pmac.c
- minor fixes in au1xxx-ide.c/cs5530.c/siimage.c
- improve patch description
Changes in behavior caused by this patch:
- HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change
PIO mode if it821x controller is in "smart" mode
- removal of two debugging printk-s (from cs5530.c and sc1200.c)
- transfer modes 0x00-0x07 passed from user space may be programmed twice on
the device (not really an issue since 0x00 is not supported correctly by
any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/pdc202xx_new.c')
-rw-r--r-- | drivers/ide/pci/pdc202xx_new.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 95600681bd3a..ad0bdcb0c02b 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -146,19 +146,16 @@ static struct udma_timing { | |||
146 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ | 146 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static int pdcnew_tune_chipset(ide_drive_t *drive, const u8 speed) | 149 | static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed) |
150 | { | 150 | { |
151 | ide_hwif_t *hwif = HWIF(drive); | 151 | ide_hwif_t *hwif = HWIF(drive); |
152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will | 155 | * IDE core issues SETFEATURES_XFER to the drive first (thanks to |
156 | * IDE_HFLAG_POST_SET_MODE in ->host_flags). PDC202xx hardware will | ||
156 | * automatically set the timing registers based on 100 MHz PLL output. | 157 | * automatically set the timing registers based on 100 MHz PLL output. |
157 | */ | 158 | * |
158 | if (ide_config_drive_speed(drive, speed)) | ||
159 | return 1; | ||
160 | |||
161 | /* | ||
162 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable | 159 | * As we set up the PLL to output 133 MHz for UltraDMA/133 capable |
163 | * chips, we must override the default register settings... | 160 | * chips, we must override the default register settings... |
164 | */ | 161 | */ |
@@ -211,13 +208,11 @@ static int pdcnew_tune_chipset(ide_drive_t *drive, const u8 speed) | |||
211 | 208 | ||
212 | set_indexed_reg(hwif, 0x10 + adj, tmp & 0x7f); | 209 | set_indexed_reg(hwif, 0x10 + adj, tmp & 0x7f); |
213 | } | 210 | } |
214 | |||
215 | return 0; | ||
216 | } | 211 | } |
217 | 212 | ||
218 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) | 213 | static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) |
219 | { | 214 | { |
220 | (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); | 215 | pdcnew_set_mode(drive, XFER_PIO_0 + pio); |
221 | } | 216 | } |
222 | 217 | ||
223 | static u8 pdcnew_cable_detect(ide_hwif_t *hwif) | 218 | static u8 pdcnew_cable_detect(ide_hwif_t *hwif) |
@@ -490,9 +485,9 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) | |||
490 | hwif->autodma = 0; | 485 | hwif->autodma = 0; |
491 | 486 | ||
492 | hwif->set_pio_mode = &pdcnew_set_pio_mode; | 487 | hwif->set_pio_mode = &pdcnew_set_pio_mode; |
488 | hwif->set_dma_mode = &pdcnew_set_mode; | ||
493 | 489 | ||
494 | hwif->quirkproc = &pdcnew_quirkproc; | 490 | hwif->quirkproc = &pdcnew_quirkproc; |
495 | hwif->speedproc = &pdcnew_tune_chipset; | ||
496 | hwif->resetproc = &pdcnew_reset; | 491 | hwif->resetproc = &pdcnew_reset; |
497 | 492 | ||
498 | hwif->err_stops_fifo = 1; | 493 | hwif->err_stops_fifo = 1; |
@@ -583,6 +578,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
583 | .bootable = OFF_BOARD, | 578 | .bootable = OFF_BOARD, |
584 | .pio_mask = ATA_PIO4, | 579 | .pio_mask = ATA_PIO4, |
585 | .udma_mask = 0x3f, /* udma0-5 */ | 580 | .udma_mask = 0x3f, /* udma0-5 */ |
581 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
586 | },{ /* 1 */ | 582 | },{ /* 1 */ |
587 | .name = "PDC20269", | 583 | .name = "PDC20269", |
588 | .init_setup = init_setup_pdcnew, | 584 | .init_setup = init_setup_pdcnew, |
@@ -592,6 +588,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
592 | .bootable = OFF_BOARD, | 588 | .bootable = OFF_BOARD, |
593 | .pio_mask = ATA_PIO4, | 589 | .pio_mask = ATA_PIO4, |
594 | .udma_mask = 0x7f, /* udma0-6*/ | 590 | .udma_mask = 0x7f, /* udma0-6*/ |
591 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
595 | },{ /* 2 */ | 592 | },{ /* 2 */ |
596 | .name = "PDC20270", | 593 | .name = "PDC20270", |
597 | .init_setup = init_setup_pdc20270, | 594 | .init_setup = init_setup_pdc20270, |
@@ -601,6 +598,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
601 | .bootable = OFF_BOARD, | 598 | .bootable = OFF_BOARD, |
602 | .pio_mask = ATA_PIO4, | 599 | .pio_mask = ATA_PIO4, |
603 | .udma_mask = 0x3f, /* udma0-5 */ | 600 | .udma_mask = 0x3f, /* udma0-5 */ |
601 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
604 | },{ /* 3 */ | 602 | },{ /* 3 */ |
605 | .name = "PDC20271", | 603 | .name = "PDC20271", |
606 | .init_setup = init_setup_pdcnew, | 604 | .init_setup = init_setup_pdcnew, |
@@ -610,6 +608,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
610 | .bootable = OFF_BOARD, | 608 | .bootable = OFF_BOARD, |
611 | .pio_mask = ATA_PIO4, | 609 | .pio_mask = ATA_PIO4, |
612 | .udma_mask = 0x7f, /* udma0-6*/ | 610 | .udma_mask = 0x7f, /* udma0-6*/ |
611 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
613 | },{ /* 4 */ | 612 | },{ /* 4 */ |
614 | .name = "PDC20275", | 613 | .name = "PDC20275", |
615 | .init_setup = init_setup_pdcnew, | 614 | .init_setup = init_setup_pdcnew, |
@@ -619,6 +618,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
619 | .bootable = OFF_BOARD, | 618 | .bootable = OFF_BOARD, |
620 | .pio_mask = ATA_PIO4, | 619 | .pio_mask = ATA_PIO4, |
621 | .udma_mask = 0x7f, /* udma0-6*/ | 620 | .udma_mask = 0x7f, /* udma0-6*/ |
621 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
622 | },{ /* 5 */ | 622 | },{ /* 5 */ |
623 | .name = "PDC20276", | 623 | .name = "PDC20276", |
624 | .init_setup = init_setup_pdc20276, | 624 | .init_setup = init_setup_pdc20276, |
@@ -628,6 +628,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
628 | .bootable = OFF_BOARD, | 628 | .bootable = OFF_BOARD, |
629 | .pio_mask = ATA_PIO4, | 629 | .pio_mask = ATA_PIO4, |
630 | .udma_mask = 0x7f, /* udma0-6*/ | 630 | .udma_mask = 0x7f, /* udma0-6*/ |
631 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
631 | },{ /* 6 */ | 632 | },{ /* 6 */ |
632 | .name = "PDC20277", | 633 | .name = "PDC20277", |
633 | .init_setup = init_setup_pdcnew, | 634 | .init_setup = init_setup_pdcnew, |
@@ -637,6 +638,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = { | |||
637 | .bootable = OFF_BOARD, | 638 | .bootable = OFF_BOARD, |
638 | .pio_mask = ATA_PIO4, | 639 | .pio_mask = ATA_PIO4, |
639 | .udma_mask = 0x7f, /* udma0-6*/ | 640 | .udma_mask = 0x7f, /* udma0-6*/ |
641 | .host_flags = IDE_HFLAG_POST_SET_MODE, | ||
640 | } | 642 | } |
641 | }; | 643 | }; |
642 | 644 | ||