pata_atp867x: PIO support fixes
* use 8 clk setting for active clocks == 7 (was 12 clk) * use 12 clk setting for active clocks > 12 (was 8 clk) * do 66MHz bus fixup before mapping active clocks * fix setup of PIO command timings Acked-by: Jung-Ik (John) Lee <jilee@google.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
64207f5913
commit
c59bcc37cb
|
@ -155,30 +155,31 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
|
||||||
struct atp867x_priv *dp = ap->private_data;
|
struct atp867x_priv *dp = ap->private_data;
|
||||||
unsigned char clocks = clk;
|
unsigned char clocks = clk;
|
||||||
|
|
||||||
switch (clocks) {
|
|
||||||
case 0:
|
|
||||||
clocks = 1;
|
|
||||||
break;
|
|
||||||
case 1 ... 7:
|
|
||||||
break;
|
|
||||||
case 9 ... 12:
|
|
||||||
clocks = 7;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
|
|
||||||
"Using default 8clk.\n", clk);
|
|
||||||
case 8: /* default 8 clk */
|
|
||||||
clocks = 0;
|
|
||||||
goto active_clock_shift_done;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Doc 6.6.9: increase the clock value by 1 for safer PIO speed
|
* Doc 6.6.9: increase the clock value by 1 for safer PIO speed
|
||||||
* on 66MHz bus
|
* on 66MHz bus
|
||||||
*/
|
*/
|
||||||
if (dp->pci66mhz && clocks < 7)
|
if (dp->pci66mhz)
|
||||||
clocks++;
|
clocks++;
|
||||||
|
|
||||||
|
switch (clocks) {
|
||||||
|
case 0:
|
||||||
|
clocks = 1;
|
||||||
|
break;
|
||||||
|
case 1 ... 6:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
|
||||||
|
"Using 12clk.\n", clk);
|
||||||
|
case 9 ... 12:
|
||||||
|
clocks = 7; /* 12 clk */
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
case 8: /* default 8 clk */
|
||||||
|
clocks = 0;
|
||||||
|
goto active_clock_shift_done;
|
||||||
|
}
|
||||||
|
|
||||||
active_clock_shift_done:
|
active_clock_shift_done:
|
||||||
return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT;
|
return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +194,8 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk)
|
||||||
break;
|
break;
|
||||||
case 1 ... 11:
|
case 1 ... 11:
|
||||||
break;
|
break;
|
||||||
case 13: case 14:
|
case 13:
|
||||||
|
case 14:
|
||||||
--clocks; /* by the spec */
|
--clocks; /* by the spec */
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
@ -235,16 +237,16 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
||||||
iowrite8(b, dp->dma_mode);
|
iowrite8(b, dp->dma_mode);
|
||||||
|
|
||||||
b = atp867x_get_active_clocks_shifted(ap, t.active) |
|
b = atp867x_get_active_clocks_shifted(ap, t.active) |
|
||||||
atp867x_get_recover_clocks_shifted(t.recover);
|
atp867x_get_recover_clocks_shifted(t.recover);
|
||||||
|
|
||||||
if (adev->devno & 1)
|
if (adev->devno & 1)
|
||||||
iowrite8(b, dp->slave_piospd);
|
iowrite8(b, dp->slave_piospd);
|
||||||
else
|
else
|
||||||
iowrite8(b, dp->mstr_piospd);
|
iowrite8(b, dp->mstr_piospd);
|
||||||
|
|
||||||
/*
|
b = atp867x_get_active_clocks_shifted(ap, t.act8b) |
|
||||||
* use the same value for comand timing as for PIO timimg
|
atp867x_get_recover_clocks_shifted(t.rec8b);
|
||||||
*/
|
|
||||||
iowrite8(b, dp->eightb_piospd);
|
iowrite8(b, dp->eightb_piospd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue