Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63549
b: refs/heads/master
c: bc0b0b5
h: refs/heads/master
i:
  63547: fae33c4
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Aug 1, 2007
1 parent 5bfb3a4 commit 0cfefe5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 070224339b52f0e4f8e6c991a5ad9630a7a9e6da
refs/heads/master: bc0b0b5c4bab02790937c9070a7701ee70feaac9
40 changes: 17 additions & 23 deletions trunk/drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* linux/drivers/ide/pci/cs5535.c
*
* Copyright (C) 2004-2005 Advanced Micro Devices, Inc.
* Copyright (C) 2007 Bartlomiej Zolnierkiewicz
*
* History:
* 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com>
Expand Down Expand Up @@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)

/* Set the PIO timings */
if ((speed & XFER_MODE) == XFER_PIO) {
u8 pioa;
u8 piob;
u8 cmd;
ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
u8 cmd, pioa;

pioa = speed - XFER_PIO_0;
piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]),
255, 4);
cmd = pioa < piob ? pioa : piob;
cmd = pioa = speed - XFER_PIO_0;

if (pair->present) {
u8 piob = ide_get_best_pio_mode(pair, 255, 4);

if (piob < cmd)
cmd = piob;
}

/* Write the speed of the current drive */
reg = (cs5535_pio_cmd_timings[cmd] << 16) |
Expand Down Expand Up @@ -151,32 +155,22 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
*
* A callback from the upper layers for PIO-only tuning.
*/
static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed)
static void cs5535_tuneproc(ide_drive_t *drive, u8 pio)
{
u8 modes[] = { XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3,
XFER_PIO_4 };

/* cs5535 max pio is pio 4, best_pio will check the blacklist.
i think we don't need to rate_filter the incoming xferspeed
since we know we're only going to choose pio */
xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4);
ide_config_drive_speed(drive, modes[xferspeed]);
cs5535_set_speed(drive, xferspeed);
pio = ide_get_best_pio_mode(drive, pio, 4);
ide_config_drive_speed(drive, XFER_PIO_0 + pio);
cs5535_set_speed(drive, XFER_PIO_0 + pio);
}

static int cs5535_dma_check(ide_drive_t *drive)
{
u8 speed;

drive->init_speed = 0;

if (ide_tune_dma(drive))
return 0;

if (ide_use_fast_pio(drive)) {
speed = ide_get_best_pio_mode(drive, 255, 4);
cs5535_set_drive(drive, speed);
}
if (ide_use_fast_pio(drive))
cs5535_tuneproc(drive, 255);

return -1;
}
Expand Down

0 comments on commit 0cfefe5

Please sign in to comment.