SOURCES: linux-2.6-sata-promise-pata-ports.patch (NEW) - patch for...

zergin zergin at pld-linux.org
Sat May 27 15:06:03 CEST 2006


Author: zergin                       Date: Sat May 27 13:06:03 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- patch for 2.6 kernels to support PATA ports on Promise SATA contorllers

---- Files affected:
SOURCES:
   linux-2.6-sata-promise-pata-ports.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.6-sata-promise-pata-ports.patch
diff -u /dev/null SOURCES/linux-2.6-sata-promise-pata-ports.patch:1.1
--- /dev/null	Sat May 27 15:06:03 2006
+++ SOURCES/linux-2.6-sata-promise-pata-ports.patch	Sat May 27 15:05:58 2006
@@ -0,0 +1,128 @@
+diff -urN linux-2.6.16.16/drivers/scsi/libata-core.c mod/drivers/scsi/libata-core.c
+--- linux-2.6.16.16/drivers/scsi/libata-core.c	2006-05-11 03:56:24.000000000 +0200
++++ mod/drivers/scsi/libata-core.c	2006-05-20 03:14:57.165778500 +0200
+@@ -4431,6 +4431,7 @@
+ 	ap->mwdma_mask = ent->mwdma_mask;
+ 	ap->udma_mask = ent->udma_mask;
+ 	ap->flags |= ent->host_flags;
++	ap->flags |= ent->port_flags[port_no];	/* pata fix */
+ 	ap->ops = ent->port_ops;
+ 	ap->cbl = ATA_CBL_NONE;
+ 	ap->active_tag = ATA_TAG_POISON;
+diff -urN linux-2.6.16.16/drivers/scsi/sata_promise.c mod/drivers/scsi/sata_promise.c
+--- linux-2.6.16.16/drivers/scsi/sata_promise.c	2006-05-11 03:56:24.000000000 +0200
++++ mod/drivers/scsi/sata_promise.c	2006-05-20 03:29:36.708746500 +0200
+@@ -165,7 +165,7 @@
+ 	/* board_2037x */
+ 	{
+ 		.sht		= &pdc_ata_sht,
+-		.host_flags	= PDC_COMMON_FLAGS | ATA_FLAG_SATA,
++		.host_flags	= PDC_COMMON_FLAGS /* | ATA_FLAG_SATA */,	/* pata fix */
+ 		.pio_mask	= 0x1f, /* pio0-4 */
+ 		.mwdma_mask	= 0x07, /* mwdma0-2 */
+ 		.udma_mask	= 0x7f, /* udma0-6 ; FIXME */
+@@ -322,15 +322,34 @@
+ 
+ static void pdc_sata_phy_reset(struct ata_port *ap)
+ {
+-	pdc_reset_port(ap);
+-	sata_phy_reset(ap);
++/*	pdc_reset_port(ap); */	/* pata fix */
++/*	sata_phy_reset(ap); */	/* pata fix */
++	/* if no sata flag, test for pata drive */	/* pata fix */
++	if (ap->flags & ATA_FLAG_SATA)	/* pata fix */
++	{				/* pata fix */
++		pdc_reset_port(ap);	/* pata fix */
++		sata_phy_reset(ap);	/* pata fix */
++	}				/* pata fix */
++	else				/* pata fix */
++		pdc_pata_phy_reset(ap);	/* pata fix */
+ }
+ 
+ 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;
++/*	ap->cbl = ATA_CBL_PATA40; */			/* pata fix */
++/*	ap->udma_mask &= ATA_UDMA_MASK_40C; */		/* pata fix */
++	/* add cable detection code for pata drives */	/* pata fix */
++	u8 tmp;						/* pata fix */
++	void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;	/* pata fix */
++	tmp = readb(mmio);				/* pata fix */
++	if (tmp & 0x01)					/* pata fix */
++	{						/* pata fix */
++		ap->cbl = ATA_CBL_PATA40;		/* pata fix */
++		ap->udma_mask &= ATA_UDMA_MASK_40C;	/* pata fix */
++	}						/* pata fix */
++	else						/* pata fix */
++		ap->cbl = ATA_CBL_PATA80;		/* pata fix */
+ 
+ 	pdc_reset_port(ap);
+ 	ata_port_probe(ap);
+@@ -646,6 +665,7 @@
+ 	unsigned int board_idx = (unsigned int) ent->driver_data;
+ 	int pci_dev_busy = 0;
+ 	int rc;
++	u8 tmp;		/* pata fix */
+ 
+ 	if (!printed_version++)
+ 		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+@@ -705,6 +725,9 @@
+ 	probe_ent->port[0].scr_addr = base + 0x400;
+ 	probe_ent->port[1].scr_addr = base + 0x500;
+ 
++	probe_ent->port_flags[0] = ATA_FLAG_SATA;	/* pata fix */
++	probe_ent->port_flags[1] = ATA_FLAG_SATA;	/* pata fix */
++	
+ 	/* notice 4-port boards */
+ 	switch (board_idx) {
+ 	case board_20319:
+@@ -715,9 +738,25 @@
+ 
+ 		probe_ent->port[2].scr_addr = base + 0x600;
+ 		probe_ent->port[3].scr_addr = base + 0x700;
++
++		probe_ent->port_flags[2] = ATA_FLAG_SATA;       /* pata fix */
++		probe_ent->port_flags[3] = ATA_FLAG_SATA;       /* pata fix */
+ 		break;
+ 	case board_2037x:
+-		probe_ent->n_ports = 2;
++/*		probe_ent->n_ports = 2; */					/* pata fix */
++/*		Some boards have also PATA port */				/* pata fix */
++
++		tmp = readb(mmio_base + PDC_FLASH_CTL+1);			/* pata fix */
++		if (!(tmp & 0x80))						/* pata fix */
++		{								/* pata fix */
++			probe_ent->n_ports = 3;					/* pata fix */
++			pdc_ata_setup_port(&probe_ent->port[2], base + 0x300);	/* pata fix */
++			probe_ent->port_flags[2] = ATA_FLAG_SLAVE_POSS;         /* pata fix */
++			printk(KERN_INFO DRV_NAME " PATA port found\n");        /* pata fix */
++		}                                               		/* pata fix */
++		else                                            		/* pata fix */
++			probe_ent->n_ports = 2;					/* pata fix */
++		
+ 		break;
+ 	case board_20771:
+ 		probe_ent->n_ports = 2;
+@@ -730,6 +769,9 @@
+ 
+ 		probe_ent->port[2].scr_addr = base + 0x600;
+ 		probe_ent->port[3].scr_addr = base + 0x700;
++
++		probe_ent->port_flags[2] = ATA_FLAG_SATA;	/* pata fix */
++		probe_ent->port_flags[3] = ATA_FLAG_SATA;	/* pata fix */
+ 		break;
+ 	default:
+ 		BUG();
+diff -urN linux-2.6.16.16/include/linux/libata.h mod/include/linux/libata.h
+--- linux-2.6.16.16/include/linux/libata.h	2006-05-11 03:56:24.000000000 +0200
++++ mod/include/linux/libata.h	2006-05-20 03:31:46.216840250 +0200
+@@ -237,6 +237,7 @@
+ 	unsigned long		irq;
+ 	unsigned int		irq_flags;
+ 	unsigned long		host_flags;
++	unsigned long           port_flags[ATA_MAX_PORTS];      /* pata fix */
+ 	void __iomem		*mmio_base;
+ 	void			*private_data;
+ };
================================================================


More information about the pld-cvs-commit mailing list