Skip to contentSkip to conversation

make sata_promise PATA ports work

PATCH In review Erik Andersen 3 participants 3 messages Dec 4, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make sata_promise PATA ports work

This patch vs 2.6.19, based on the not-actually-working-for-me code lurking in libata-dev.git#promise-sata-pata, makes the PATA ports on my promise sata card actually work. Since the plan as checked into git, is to drive the PATA ports as if they were SATA, we have to teach sata_scr_read() to lie for the PATA ports which don't to that, lest the various places that call ata_port_offline() and ata_port_online() should fail and leave the ports offline and inaccessible.

This patch gets both SATA and PATA working for me with the sata_promise driver on a PDC20375. Performace seems to be about what I would expect, so this (or something very much like it) should be applied upstream.

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

drivers/ata/libata-core.c +2 -2
index 915a55a..d0ab733 100644
@@ -5298,13 +5298,13 @@ void ata_port_init(struct ata_port *ap, 
 		ap->pio_mask = ent->pinfo2->pio_mask;
 		ap->mwdma_mask = ent->pinfo2->mwdma_mask;
 		ap->udma_mask = ent->pinfo2->udma_mask;
-		ap->flags |= ent->pinfo2->flags;
+		ap->flags |= ent->pinfo2->flags | ent->_port_flags[port_no];
 		ap->ops = ent->pinfo2->port_ops;
 	} else {
 		ap->pio_mask = ent->pio_mask;
 		ap->mwdma_mask = ent->mwdma_mask;
 		ap->udma_mask = ent->udma_mask;
-		ap->flags |= ent->port_flags;
+		ap->flags |= ent->port_flags | ent->_port_flags[port_no];
 		ap->ops = ent->port_ops;
 	}
 	ap->hw_sata_spd_limit = UINT_MAX;
drivers/ata/sata_promise.c +42 -6

110 lines not on this page · raw message

include/linux/libata.h +1 -0
index abd2deb..aa8c822 100644
@@ -377,6 +377,7 @@ struct ata_probe_ent {
 	unsigned int		irq_flags;
 	unsigned long		port_flags;
 	unsigned long		_host_flags;
+	unsigned long		_port_flags[ATA_MAX_PORTS];
 	void __iomem		*mmio_base;
 	void			*private_data;
 
#1 lore raw
Quoted 3 lines · On Mon, 4 Dec 2006 12:47:37 -0700 Erik Andersen <[email protected]> wrote:

This patch vs 2.6.19, based on the not-actually-working-for-me code lurking in libata-dev.git#promise-sata-pata, makes the PATA ports on my promise sata card actually work. Since the plan as

Nice, this is pretty much what is needed to polish up the other split PATA/SATA cases.

#2 lore raw
Quoted 9 lines · Alan
Quoted 3 lines · On Mon, 4 Dec 2006 12:47:37 -0700 Erik Andersen <[email protected]> wrote:

This patch vs 2.6.19, based on the not-actually-working-for-me code lurking in libata-dev.git#promise-sata-pata, makes the PATA ports on my promise sata card actually work. Since the plan as

Nice, this is pretty much what is needed to polish up the other split PATA/SATA cases.

Disagree. Internal libata is set up so that you can have different ata_port::flags and ata_port::ops for each port, which is what enables proper hardware sharing between SATA and PATA.

Two things need to happen:

1) probe_ent needs to permit a driver to supply multiple flags/ops pairs, not just one for the whole driver, and pass that through to the proper data structures during ata_port init.

2) a VERY FEW details like ->irq_clear() are really ata_host level hooks, but they live in ata_port_operations because there is no ata_host_operations. Fix these.

Once those issues are fixed, PATA+SATA can be easily support on the combinations of hardware that have been desperately wanting it: sata_promise, sata_sis, sata_via (sata_uli too?)

Jeff