This will update the following files: drivers/scsi/libata-core.c include/linux/libata.h drivers/scsi/sata_promise.c through these ChangeSets: o [libata sata_promise] support PATA ports on SATA controllers patches provided by Erik Benada ErikBenada@yahoo.ca Mikael Pattersson mkpe@it.uu.se Jim Bevier jbev@jbsys.com diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c --- a/drivers/ata/libata-core.c 2006-12-27 13:57:22.000000000 -0700 +++ b/drivers/ata/libata-core.c 2007-01-12 22:16:15.000000000 -0700 @@ -5620,12 +5620,14 @@ ap->mwdma_mask = ent->pinfo2->mwdma_mask; ap->udma_mask = ent->pinfo2->udma_mask; ap->flags |= ent->pinfo2->flags; + ap->flags |= ent->pata_flags[port_no]; /* pata fix */ 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->pata_flags[port_no]; /* pata fix */ ap->ops = ent->port_ops; } ap->hw_sata_spd_limit = UINT_MAX; diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c --- a/drivers/ata/sata_promise.c 2006-12-27 12:32:27.000000000 -0700 +++ b/drivers/ata/sata_promise.c 2007-01-12 16:11:44.000000000 -0700 @@ -183,7 +183,7 @@ /* board_2037x */ { .sht = &pdc_ata_sht, - .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, + .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 */ @@ -213,7 +213,7 @@ /* board_2057x */ { .sht = &pdc_ata_sht, - .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, + .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 */ @@ -377,7 +377,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) { - if (sc_reg > SCR_CONTROL) + if (sc_reg > SCR_CONTROL || ap-flags & ATA_FLAG_SLAVE_POSS) /* pata fix */ return 0xffffffffU; return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); } @@ -386,7 +386,7 @@ static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) { - if (sc_reg > SCR_CONTROL) + if (sc_reg > SCR_CONTROL || ap-flags & ATA_FLAG_SLAVE_POSS) /* pata fix */ return; writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); } @@ -740,6 +740,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"); @@ -802,6 +803,10 @@ probe_ent->port[0].scr_addr = base + 0x400; probe_ent->port[1].scr_addr = base + 0x500; + /* default first two ports to SATA */ /* pata fix */ + probe_ent->pata_flags[0] = ATA_FLAG_SATA; /* pata fix */ + probe_ent->pata_flags[1] = ATA_FLAG_SATA; /* pata fix */ + /* notice 4-port boards */ switch (board_idx) { case board_40518: @@ -815,12 +820,26 @@ probe_ent->port[2].scr_addr = base + 0x600; probe_ent->port[3].scr_addr = base + 0x700; + + /* all ports are SATA */ /* pata fix */ + probe_ent->pata_flags[2] = ATA_FLAG_SATA; /* pata fix */ + probe_ent->pata_flags[3] = ATA_FLAG_SATA; /* pata fix */ break; case board_2057x: hp->flags |= PDC_FLAG_GEN_II; /* Fall through */ case board_2037x: probe_ent->n_ports = 2; + /* the first two ports are always SATA */ /* pata fix */ + /* Some boards also have a 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->pata_flags[2] = ATA_FLAG_SLAVE_POSS; /* pata fix */ + printk(KERN_INFO DRV_NAME " PATA port found\n"); /* pata fix */ + } /* pata fix */ break; case board_20619: probe_ent->n_ports = 4; @@ -830,6 +849,10 @@ probe_ent->port[2].scr_addr = base + 0x600; probe_ent->port[3].scr_addr = base + 0x700; + + /* all ports are SATA */ /* pata fix */ + probe_ent->pata_flags[2] = ATA_FLAG_SATA; /* pata fix */ + probe_ent->pata_flags[3] = ATA_FLAG_SATA; /* pata fix */ break; default: BUG(); diff -Nru a/include/linux/libata.h b/include/linux/libata.h --- a/include/linux/libata.h 2006-12-27 13:58:14.000000000 -0700 +++ b/include/linux/libata.h 2007-01-12 10:38:28.000000000 -0700 @@ -383,6 +383,7 @@ unsigned long irq2; unsigned int irq_flags; unsigned long port_flags; + unsigned long pata_flags[ATA_MAX_PORTS]; /* pata fix */ unsigned long _host_flags; void __iomem *mmio_base; void *private_data;