Skip to content

Commit

Permalink
[libata sata_promise] Add PATA cable detection.
Browse files Browse the repository at this point in the history
Original patch from Phillip Jordan <phillip.m.jordan@gmail.com>
Cleanups and fixes by me.
  • Loading branch information
Jeff Garzik committed May 24, 2006
1 parent 4c5c816 commit d3fb4e8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions drivers/scsi/sata_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,23 @@ static void pdc_sata_phy_reset(struct ata_port *ap)
sata_phy_reset(ap);
}

static void pdc_pata_phy_reset(struct ata_port *ap)
static void pdc_pata_cbl_detect(struct ata_port *ap)
{
/* FIXME: add cable detect. Don't assume 40-pin cable */
ap->cbl = ATA_CBL_PATA40;
ap->udma_mask &= ATA_UDMA_MASK_40C;
u8 tmp;
void __iomem *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;

tmp = readb(mmio);

if (tmp & 0x01) {
ap->cbl = ATA_CBL_PATA40;
ap->udma_mask &= ATA_UDMA_MASK_40C;
} else
ap->cbl = ATA_CBL_PATA80;
}

static void pdc_pata_phy_reset(struct ata_port *ap)
{
pdc_pata_cbl_detect(ap);
pdc_reset_port(ap);
ata_port_probe(ap);
ata_bus_reset(ap);
Expand Down

0 comments on commit d3fb4e8

Please sign in to comment.