Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58707
b: refs/heads/master
c: d0e5803
h: refs/heads/master
i:
  58705: f587fcd
  58703: 721515b
v: v3
  • Loading branch information
Mikael Pettersson authored and Jeff Garzik committed Jul 9, 2007
1 parent 01bb842 commit d86c615
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5446b656ddebc2f3902242fda4e860fb343d2787
refs/heads/master: d0e580316e3db9f5cf6a605cc311ffb0372f0a35
56 changes: 23 additions & 33 deletions trunk/drivers/ata/sata_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
#include "sata_promise.h"

#define DRV_NAME "sata_promise"
#define DRV_VERSION "2.07"

#define DRV_VERSION "2.08"

enum {
PDC_MAX_PORTS = 4,
Expand Down Expand Up @@ -94,7 +93,7 @@ enum {
board_20319 = 2, /* FastTrak S150 TX4 */
board_20619 = 3, /* FastTrak TX4000 */
board_2057x = 4, /* SATAII150 Tx2plus */
board_2057x_pata = 5, /* SATAII150 Tx2plus */
board_2057x_pata = 5, /* SATAII150 Tx2plus PATA port */
board_40518 = 6, /* SATAII150 Tx4 */

PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */
Expand Down Expand Up @@ -124,7 +123,6 @@ enum {
PDC_FLAG_4_PORTS = (1 << 26), /* 4 ports */
};


struct pdc_port_priv {
u8 *pkt;
dma_addr_t pkt_dma;
Expand Down Expand Up @@ -340,15 +338,13 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
{ } /* terminate list */
};


static struct pci_driver pdc_ata_pci_driver = {
.name = DRV_NAME,
.id_table = pdc_ata_pci_tbl,
.probe = pdc_ata_init_one,
.remove = ata_pci_remove_one,
};


static int pdc_common_port_start(struct ata_port *ap)
{
struct device *dev = ap->host->dev;
Expand Down Expand Up @@ -438,7 +434,6 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
return readl(ap->ioaddr.scr_addr + (sc_reg * 4));
}


static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
u32 val)
{
Expand Down Expand Up @@ -657,8 +652,8 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
ata_port_abort(ap);
}

static inline unsigned int pdc_host_intr( struct ata_port *ap,
struct ata_queued_cmd *qc)
static inline unsigned int pdc_host_intr(struct ata_port *ap,
struct ata_queued_cmd *qc)
{
unsigned int handled = 0;
void __iomem *port_mmio = ap->ioaddr.cmd_addr;
Expand All @@ -685,10 +680,10 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
handled = 1;
break;

default:
default:
ap->stats.idle_irq++;
break;
}
}

return handled;
}
Expand All @@ -701,6 +696,18 @@ static void pdc_irq_clear(struct ata_port *ap)
readl(mmio + PDC_INT_SEQMASK);
}

static inline int pdc_is_sataii_tx4(unsigned long flags)
{
const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS;
return (flags & mask) == mask;
}

static inline unsigned int pdc_port_no_to_ata_no(unsigned int port_no, int is_sataii_tx4)
{
static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2};
return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no;
}

static irqreturn_t pdc_interrupt (int irq, void *dev_instance)
{
struct ata_host *host = dev_instance;
Expand Down Expand Up @@ -807,7 +814,6 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
ata_tf_load(ap, tf);
}


static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
{
WARN_ON (tf->protocol == ATA_PROT_DMA ||
Expand Down Expand Up @@ -867,7 +873,6 @@ static void pdc_ata_setup_port(struct ata_port *ap,
ap->ioaddr.scr_addr = scr_addr;
}


static void pdc_host_init(struct ata_host *host)
{
void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
Expand Down Expand Up @@ -955,10 +960,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e

if (pi->flags & PDC_FLAG_SATA_PATA) {
u8 tmp = readb(base + PDC_FLASH_CTL+1);
if (!(tmp & 0x80)) {
if (!(tmp & 0x80))
ppi[n_ports++] = pi + 1;
dev_printk(KERN_INFO, &pdev->dev, "PATA port found\n");
}
}

host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
Expand All @@ -968,22 +971,12 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
}
host->iomap = pcim_iomap_table(pdev);

is_sataii_tx4 = 0;
if ((pi->flags & (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) == (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) {
is_sataii_tx4 = 1;
dev_printk(KERN_INFO, &pdev->dev, "applying SATAII TX4 port numbering workaround\n");
}
is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags);
for (i = 0; i < host->n_ports; i++) {
static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2};
int ata_nr;

ata_nr = i;
if (is_sataii_tx4)
ata_nr = sataii_tx4_port_remap[i];

unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4);
pdc_ata_setup_port(host->ports[i],
base + 0x200 + ata_nr * 0x80,
base + 0x400 + ata_nr * 0x100);
base + 0x200 + ata_no * 0x80,
base + 0x400 + ata_no * 0x100);
}

/* initialize adapter */
Expand All @@ -1002,19 +995,16 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
&pdc_ata_sht);
}


static int __init pdc_ata_init(void)
{
return pci_register_driver(&pdc_ata_pci_driver);
}


static void __exit pdc_ata_exit(void)
{
pci_unregister_driver(&pdc_ata_pci_driver);
}


MODULE_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver");
MODULE_LICENSE("GPL");
Expand Down

0 comments on commit d86c615

Please sign in to comment.