Skip to contentSkip to conversation

PATA port support for PDC2037x

PATCH In review Erik Benada 2 participants 3 messages Sep 30, 2004

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

PATCH 1/1 PATA port support for PDC2037x

Jeff,

included is patch to add support for PATA port on Promise PDC2037x controllers. Patch is against 2.6.8.1 vanilla kernel.
I tested this patch on my PDC20378 on-board controller with 1 PATA drive attached. I didn't do any large testing but my drive was detected properly and I was able to mount and use filesystem on it.

I tried to minimize changes to libata code. I just added flags for each port to ata_probe_ent structure and modified ata_host_init() function.

Promise SATA driver was changed to use new ata_probe_ent->port_flags, check for presence of PATA port and pdc_phy_reset will use different reset code for PATA and SATA ports.

Any comments, suggestions?

Erik

diff -uprN -X dontdiff linux-2.6.8.1-vanilla/drivers/scsi/libata-core.c linux-2.6.8.1-PATA/drivers/scsi/libata-core.c

drivers/scsi/libata-core.c +1 -0
@@ -2806,6 +2806,7 @@ static void ata_host_init(struct ata_por
 	ap->pio_mask = ent->pio_mask;
 	ap->udma_mask = ent->udma_mask;
 	ap->flags |= ent->host_flags;
+	ap->flags |= ent->port_flags[port_no];
 	ap->ops = ent->port_ops;
 	ap->cbl = ATA_CBL_NONE;
 	ap->device[0].flags = ATA_DFLAG_MASTER;

diff -uprN -X dontdiff linux-2.6.8.1-vanilla/drivers/scsi/sata_promise.c linux-2.6.8.1-PATA/drivers/scsi/sata_promise.c

drivers/scsi/sata_promise.c +53 -3

94 lines not on this page · raw message

diff -uprN -X dontdiff linux-2.6.8.1-vanilla/include/linux/libata.h linux-2.6.8.1-PATA/include/linux/libata.h

include/linux/libata.h +1 -0
@@ -193,6 +193,7 @@ struct ata_probe_ent {
 	unsigned long		irq;
 	unsigned int		irq_flags;
 	unsigned long		host_flags;
+	unsigned long		port_flags[ATA_MAX_PORTS];
 	void			*mmio_base;
 	void			*private_data;
 };

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

#1 lore raw
Quoted 7 lines · Erik Benada

Jeff,

included is patch to add support for PATA port on Promise PDC2037x controllers.
Patch is against 2.6.8.1 vanilla kernel.
I tested this patch on my PDC20378 on-board controller with 1 PATA drive attached.
I didn't do any large testing but my drive was detected properly and I was able to mount and use filesystem on it.

Quoted 7 lines

I tried to minimize changes to libata code. I just added flags for each port to ata_probe_ent structure and modified ata_host_init() function.

Promise SATA driver was changed to use new ata_probe_ent->port_flags, check for presence of PATA port and pdc_phy_reset will use different reset code for PATA and SATA ports.

Any comments, suggestions?

Very nice!

I don't see any bugs in the code... my main concern is that I definitely want to see host controllers (struct ata_host_set) support multiple ata_port_operations structures. That would eliminate the need to do

+ if (ap->flags & ATA_FLAG_SATA)
+ sata_phy_reset(ap);
+ else
+ pdc_pata_phy_reset(ap);

and also eliminate a few other roadblocks.

However, implementing such is not a simple as your solution.

I will definitely merge this patch into my libata-dev queue, so that others can download and test it (and/or simply get their PATA port working). We'll see where it goes from there. If nobody (including me) implements the ata_port_operations solution I described, then I will probably push this into upstream 2.6.x as an incremental step towards the proper solution.

Thanks,

Jeff

#2 lore raw

Hi Jeff,

I can work on support for multiple ata_port_operations. It just seemed to me as unnecessary big change to libata. You would need separate ata_port_operations for each port regardless - even if they are the same.
What do you think about moving ata_port_operations from ata_host_set structure to ata_port structure? It would make sense if you want separate ata_port_operations for each port. Let me know.

Erik

Quoted 41 lines · --- Jeff Garzik
Quoted 8 lines · Erik Benada

Jeff,

included is patch to add support for PATA port on Promise PDC2037x controllers. Patch is against 2.6.8.1 vanilla kernel.
I tested this patch on my PDC20378 on-board controller with 1 PATA drive attached. I didn't do any large testing but my drive was detected properly and I was able to mount and use filesystem on it.

Quoted 7 lines

I tried to minimize changes to libata code. I just added flags for each port to ata_probe_ent structure and modified ata_host_init() function.

Promise SATA driver was changed to use new ata_probe_ent->port_flags, check for presence of PATA port and pdc_phy_reset will use different reset code for PATA and SATA ports.

Any comments, suggestions?

Very nice!

I don't see any bugs in the code... my main concern is that I definitely want to see host controllers (struct ata_host_set) support multiple ata_port_operations structures. That would eliminate the need to do

drivers/scsi/sata_promise.c +4 -0
+	if (ap->flags & ATA_FLAG_SATA)
+		sata_phy_reset(ap);
+	else
+		pdc_pata_phy_reset(ap);

and also eliminate a few other roadblocks.

However, implementing such is not a simple as your solution.

I will definitely merge this patch into my libata-dev queue, so that others can download and test it (and/or simply get their PATA port
working). We'll see where it goes from there. If nobody (including
me) implements the ata_port_operations solution I described, then I will probably push this into upstream 2.6.x as an incremental step towards the proper solution.

Quoted 8 lines

Thanks,

Jeff

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca