diff options
author | Jeff Garzik | 2006-05-24 07:43:25 +0200 |
---|---|---|
committer | Jeff Garzik | 2006-05-24 07:43:25 +0200 |
commit | d3fb4e8dddebbf7d6c0b02842c619bfd4fa199f5 (patch) | |
tree | 71fda9bd6527463079f9b936abaa0abe5c90da24 /drivers/scsi | |
parent | [PATCH] sata_nv: Add MCP61 support (diff) | |
download | kernel-qcow2-linux-d3fb4e8dddebbf7d6c0b02842c619bfd4fa199f5.tar.gz kernel-qcow2-linux-d3fb4e8dddebbf7d6c0b02842c619bfd4fa199f5.tar.xz kernel-qcow2-linux-d3fb4e8dddebbf7d6c0b02842c619bfd4fa199f5.zip |
[libata sata_promise] Add PATA cable detection.
Original patch from Phillip Jordan <phillip.m.jordan@gmail.com>
Cleanups and fixes by me.
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sata_promise.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index bb000438cb6c..285ab0263d91 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -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); |