aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/ahci.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 7b0640bc0079..4e96ec5f2ff9 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -134,6 +134,7 @@ enum {
134 PORT_IRQ_D2H_REG_FIS, 134 PORT_IRQ_D2H_REG_FIS,
135 135
136 /* PORT_CMD bits */ 136 /* PORT_CMD bits */
137 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
137 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 138 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
138 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ 139 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */
139 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ 140 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */
@@ -441,7 +442,7 @@ static void ahci_phy_reset(struct ata_port *ap)
441 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 442 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
442 struct ata_taskfile tf; 443 struct ata_taskfile tf;
443 struct ata_device *dev = &ap->device[0]; 444 struct ata_device *dev = &ap->device[0];
444 u32 tmp; 445 u32 new_tmp, tmp;
445 446
446 __sata_phy_reset(ap); 447 __sata_phy_reset(ap);
447 448
@@ -455,8 +456,21 @@ static void ahci_phy_reset(struct ata_port *ap)
455 tf.nsect = (tmp) & 0xff; 456 tf.nsect = (tmp) & 0xff;
456 457
457 dev->class = ata_dev_classify(&tf); 458 dev->class = ata_dev_classify(&tf);
458 if (!ata_dev_present(dev)) 459 if (!ata_dev_present(dev)) {
459 ata_port_disable(ap); 460 ata_port_disable(ap);
461 return;
462 }
463
464 /* Make sure port's ATAPI bit is set appropriately */
465 new_tmp = tmp = readl(port_mmio + PORT_CMD);
466 if (dev->class == ATA_DEV_ATAPI)
467 new_tmp |= PORT_CMD_ATAPI;
468 else
469 new_tmp &= ~PORT_CMD_ATAPI;
470 if (new_tmp != tmp) {
471 writel(new_tmp, port_mmio + PORT_CMD);
472 readl(port_mmio + PORT_CMD); /* flush */
473 }
460} 474}
461 475
462static u8 ahci_check_status(struct ata_port *ap) 476static u8 ahci_check_status(struct ata_port *ap)