ide: remove XFER_* masks from ide-timing.h
* Check requested xfer mode against xfer modes instead of XFER_* masks in ide_timing_compute() and cs5535.c::cs5535_set_speed(). * Remove XFER_[MODE,MWDMA,EPIO,PIO] masks. There should be no functional changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
3be53f3f21
commit
bd887f72d2
@ -70,11 +70,6 @@ static struct ide_timing ide_timing[] = {
|
|||||||
#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
|
#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
|
||||||
#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
|
#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
|
||||||
|
|
||||||
#define XFER_MODE 0xf0
|
|
||||||
#define XFER_MWDMA 0x20
|
|
||||||
#define XFER_EPIO 0x01
|
|
||||||
#define XFER_PIO 0x00
|
|
||||||
|
|
||||||
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
|
static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
|
||||||
{
|
{
|
||||||
q->setup = EZ(t->setup * 1000, T);
|
q->setup = EZ(t->setup * 1000, T);
|
||||||
@ -137,17 +132,12 @@ static int ide_timing_compute(ide_drive_t *drive, u8 speed,
|
|||||||
|
|
||||||
memset(&p, 0, sizeof(p));
|
memset(&p, 0, sizeof(p));
|
||||||
|
|
||||||
switch (speed & XFER_MODE) {
|
if (speed <= XFER_PIO_2)
|
||||||
|
p.cycle = p.cyc8b = id->eide_pio;
|
||||||
case XFER_PIO:
|
else if (speed <= XFER_PIO_5)
|
||||||
if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = id->eide_pio;
|
p.cycle = p.cyc8b = id->eide_pio_iordy;
|
||||||
else p.cycle = p.cyc8b = id->eide_pio_iordy;
|
else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
|
||||||
break;
|
p.cycle = id->eide_dma_min;
|
||||||
|
|
||||||
case XFER_MWDMA:
|
|
||||||
p.cycle = id->eide_dma_min;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
|
ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
|
||||||
}
|
}
|
||||||
@ -164,7 +154,7 @@ static int ide_timing_compute(ide_drive_t *drive, u8 speed,
|
|||||||
* slower/equal than the fastest PIO timing.
|
* slower/equal than the fastest PIO timing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((speed & XFER_MODE) != XFER_PIO) {
|
if (speed >= XFER_SW_DMA_0) {
|
||||||
u8 pio = ide_get_best_pio_mode(drive, 255, 5);
|
u8 pio = ide_get_best_pio_mode(drive, 255, 5);
|
||||||
ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT);
|
ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT);
|
||||||
ide_timing_merge(&p, t, t, IDE_TIMING_ALL);
|
ide_timing_merge(&p, t, t, IDE_TIMING_ALL);
|
||||||
|
@ -75,13 +75,11 @@ static unsigned int cs5535_udma_timings[5] =
|
|||||||
*/
|
*/
|
||||||
static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
|
static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
|
||||||
{
|
{
|
||||||
|
|
||||||
u32 reg = 0, dummy;
|
u32 reg = 0, dummy;
|
||||||
int unit = drive->select.b.unit;
|
int unit = drive->select.b.unit;
|
||||||
|
|
||||||
|
|
||||||
/* Set the PIO timings */
|
/* Set the PIO timings */
|
||||||
if ((speed & XFER_MODE) == XFER_PIO) {
|
if (speed < XFER_SW_DMA_0) {
|
||||||
ide_drive_t *pair = ide_get_paired_drive(drive);
|
ide_drive_t *pair = ide_get_paired_drive(drive);
|
||||||
u8 cmd, pioa;
|
u8 cmd, pioa;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user