diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 0bcf867..d3dd8e6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -3048,6 +3048,7 @@ static void ata_dev_xfermask(struct ata_ struct ata_port *ap = dev->ap; struct ata_host_set *hs = ap->host_set; unsigned long xfer_mask; + int i; /* controller modes available */ xfer_mask = ata_pack_xfermask(ap->pio_mask, @@ -3075,6 +3076,16 @@ static void ata_dev_xfermask(struct ata_ "other device, disabling DMA\n"); } + /* Use the lowest common PIO mode to avoid violating device + * selection timing. + */ + for (i = 0; i < ATA_MAX_DEVICES; i++) { + struct ata_device *d = &ap->device[i]; + if (!ata_dev_absent(d)) + xfer_mask &= ata_pack_xfermask(d->pio_mask, + UINT_MAX, UINT_MAX); + } + if (ap->ops->mode_filter) xfer_mask = ap->ops->mode_filter(ap, dev, xfer_mask);