aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:18 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:18 -0500
commitad4ba7dcef285c92a6856e0dd9feb780c1a79b87 (patch)
treed6bc703634e814c11775f609279420659f7be84a
parent3071a9d00b8684899d93f368e670c4de0293df29 (diff)
pdc202xx_new: move PIO programming code to pdcnew_set_pio_mode()
* Move PIO programming code from pdcnew_set_mode() to pdcnew_set_pio_mode(). * Rename pdcnew_set_mode() to pdcnew_set_dma_mode(). There should be no functionality changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/pci/pdc202xx_new.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 2b4f44e45a1a..79ba8eff3644 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -146,7 +146,7 @@ static struct udma_timing {
146 { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ 146 { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */
147}; 147};
148 148
149static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed) 149static void pdcnew_set_dma_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;
@@ -177,7 +177,6 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed)
177 set_indexed_reg(hwif, 0x12 + adj, 177 set_indexed_reg(hwif, 0x12 + adj,
178 udma_timings[mode].reg12); 178 udma_timings[mode].reg12);
179 break; 179 break;
180
181 case XFER_MW_DMA_2: 180 case XFER_MW_DMA_2:
182 case XFER_MW_DMA_1: 181 case XFER_MW_DMA_1:
183 case XFER_MW_DMA_0: 182 case XFER_MW_DMA_0:
@@ -186,18 +185,6 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed)
186 set_indexed_reg(hwif, 0x0f + adj, 185 set_indexed_reg(hwif, 0x0f + adj,
187 mwdma_timings[mode].reg0f); 186 mwdma_timings[mode].reg0f);
188 break; 187 break;
189 case XFER_PIO_4:
190 case XFER_PIO_3:
191 case XFER_PIO_2:
192 case XFER_PIO_1:
193 case XFER_PIO_0:
194 set_indexed_reg(hwif, 0x0c + adj,
195 pio_timings[mode].reg0c);
196 set_indexed_reg(hwif, 0x0d + adj,
197 pio_timings[mode].reg0d);
198 set_indexed_reg(hwif, 0x13 + adj,
199 pio_timings[mode].reg13);
200 break;
201 default: 188 default:
202 printk(KERN_ERR "pdc202xx_new: " 189 printk(KERN_ERR "pdc202xx_new: "
203 "Unknown speed %d ignored\n", speed); 190 "Unknown speed %d ignored\n", speed);
@@ -212,7 +199,14 @@ static void pdcnew_set_mode(ide_drive_t *drive, const u8 speed)
212 199
213static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) 200static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio)
214{ 201{
215 pdcnew_set_mode(drive, XFER_PIO_0 + pio); 202 ide_hwif_t *hwif = drive->hwif;
203 u8 adj = (drive->dn & 1) ? 0x08 : 0x00;
204
205 if (max_dma_rate(hwif->pci_dev) == 4) {
206 set_indexed_reg(hwif, 0x0c + adj, pio_timings[pio].reg0c);
207 set_indexed_reg(hwif, 0x0d + adj, pio_timings[pio].reg0d);
208 set_indexed_reg(hwif, 0x13 + adj, pio_timings[pio].reg13);
209 }
216} 210}
217 211
218static u8 pdcnew_cable_detect(ide_hwif_t *hwif) 212static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
@@ -466,7 +460,7 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha
466static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) 460static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
467{ 461{
468 hwif->set_pio_mode = &pdcnew_set_pio_mode; 462 hwif->set_pio_mode = &pdcnew_set_pio_mode;
469 hwif->set_dma_mode = &pdcnew_set_mode; 463 hwif->set_dma_mode = &pdcnew_set_dma_mode;
470 464
471 hwif->quirkproc = &pdcnew_quirkproc; 465 hwif->quirkproc = &pdcnew_quirkproc;
472 hwif->resetproc = &pdcnew_reset; 466 hwif->resetproc = &pdcnew_reset;