Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14418
b: refs/heads/master
c: ca45160
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Nov 18, 2005
1 parent ed9d660 commit 60ac8c1
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 11 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: 7d1ce682d08625258524d23ef5eb9e7ae261c1d0
refs/heads/master: ca45160db70661a006d884df07f82c9b51d27a52
76 changes: 66 additions & 10 deletions trunk/drivers/scsi/sata_sil24.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static struct ata_port_info sil24_port_info[] = {
{
.sht = &sil24_sht,
.host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
ATA_FLAG_SRST | ATA_FLAG_MMIO |
ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4),
.pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
Expand All @@ -344,7 +344,7 @@ static struct ata_port_info sil24_port_info[] = {
{
.sht = &sil24_sht,
.host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
ATA_FLAG_SRST | ATA_FLAG_MMIO |
ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2),
.pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
Expand All @@ -355,7 +355,7 @@ static struct ata_port_info sil24_port_info[] = {
{
.sht = &sil24_sht,
.host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
ATA_FLAG_SRST | ATA_FLAG_MMIO |
ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1),
.pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma0-2 */
Expand Down Expand Up @@ -415,16 +415,72 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
*tf = pp->tf;
}

static void sil24_phy_reset(struct ata_port *ap)
static int sil24_issue_SRST(struct ata_port *ap)
{
__sata_phy_reset(ap);
void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
struct sil24_port_priv *pp = ap->private_data;
struct sil24_prb *prb = &pp->cmd_block[0].prb;
dma_addr_t paddr = pp->cmd_block_dma;
u32 irq_enable, irq_stat;
int cnt;

/* temporarily turn off IRQs during SRST */
irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
writel(irq_enable, port + PORT_IRQ_ENABLE_CLR);

/*
* No ATAPI yet. Just unconditionally indicate ATA device.
* If ATAPI device is attached, it will fail ATA_CMD_ID_ATA
* and libata core will ignore the device.
* XXX: Not sure whether the following sleep is needed or not.
* The original driver had it. So....
*/
if (!(ap->flags & ATA_FLAG_PORT_DISABLED))
ap->device[0].class = ATA_DEV_ATA;
msleep(10);

prb->ctrl = PRB_CTRL_SRST;
prb->fis[1] = 0; /* no PM yet */

writel((u32)paddr, port + PORT_CMD_ACTIVATE);

for (cnt = 0; cnt < 100; cnt++) {
irq_stat = readl(port + PORT_IRQ_STAT);
writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */

irq_stat >>= PORT_IRQ_RAW_SHIFT;
if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
break;

msleep(1);
}

/* restore IRQs */
writel(irq_enable, port + PORT_IRQ_ENABLE_SET);

if (!(irq_stat & PORT_IRQ_COMPLETE))
return -1;

/* update TF */
sil24_update_tf(ap);
return 0;
}

static void sil24_phy_reset(struct ata_port *ap)
{
struct sil24_port_priv *pp = ap->private_data;

__sata_phy_reset(ap);
if (ap->flags & ATA_FLAG_PORT_DISABLED)
return;

if (sil24_issue_SRST(ap) < 0) {
printk(KERN_ERR DRV_NAME
" ata%u: SRST failed, disabling port\n", ap->id);
ap->ops->port_disable(ap);
return;
}

ap->device->class = ata_dev_classify(&pp->tf);

/* No ATAPI yet */
if (ap->device->class == ATA_DEV_ATAPI)
ap->ops->port_disable(ap);
}

static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
Expand Down

0 comments on commit 60ac8c1

Please sign in to comment.