linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.16.4 1/2] sata_promise: alternative PATA support on pdc2037x without libata interface changes
@ 2006-04-21  0:09 Phillip Jordan
  0 siblings, 0 replies; only message in thread
From: Phillip Jordan @ 2006-04-21  0:09 UTC (permalink / raw)
  To: linux-ide, jgarzik

Add support for detecting the cable bit for PATA ports in the
sata_promise driver.

Signed-off-by: Phil Jordan <phillip.m.jordan@gmail.com>

---
Notes:
* Use together with alternative PATA support patch. (2/2)
* Based on current libata development branch and PATA support patch by
Erik Benada from early 2005 (?)

phil

--- sata_promise.c	2006-04-12 21:27:57.000000000 +0100
+++ sata_promise.c	2006-04-16 22:27:00.000000000 +0100
@@ -96,6 +96,7 @@ static void pdc_tf_load_mmio(struct ata_
 static void pdc_exec_command_mmio(struct ata_port *ap, const struct
ata_taskfile *tf);
 static void pdc_irq_clear(struct ata_port *ap);
 static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
+static void pdc_pata_cbl_detect(struct ata_port *ap);


 static struct scsi_host_template pdc_ata_sht = {
@@ -326,11 +339,25 @@ static void pdc_sata_phy_reset(struct at
 	sata_phy_reset(ap);
 }

+static void pdc_pata_cbl_detect(struct ata_port *ap)
+{
+	u8 tmp;
+	void *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)
 {
-	/* FIXME: add cable detect.  Don't assume 40-pin cable */
-	ap->cbl = ATA_CBL_PATA40;
-	ap->udma_mask &= ATA_UDMA_MASK_40C;
+	/* FIX: added cable detect.  Don't assume 40-pin cable */
+	pdc_pata_cbl_detect(ap);

 	pdc_reset_port(ap);
 	ata_port_probe(ap);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-21  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-21  0:09 [PATCH 2.6.16.4 1/2] sata_promise: alternative PATA support on pdc2037x without libata interface changes Phillip Jordan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).