aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-12 23:05:14 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-12 23:05:14 -0500
commit2a47ce06d534692f9bd2bf4e90a20fc9b1054c39 (patch)
tree5fb73a701184acc117509dbe20cd59c62e7034ec /drivers/scsi
parent101ffae26c23ea928fce6d31a8b4901327d91a15 (diff)
[libata sata_mv] call phy fixups during init, as well as phy reset
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sata_mv.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index f695d0bbb5cc..5defd056fe1c 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -293,7 +293,8 @@ struct mv_port_signal {
293 293
294struct mv_host_priv; 294struct mv_host_priv;
295struct mv_hw_ops { 295struct mv_hw_ops {
296 void (*phy_errata)(struct ata_port *ap); 296 void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio,
297 unsigned int port);
297 void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); 298 void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio);
298 void (*read_preamp)(struct mv_host_priv *hpriv, int idx, 299 void (*read_preamp)(struct mv_host_priv *hpriv, int idx,
299 void __iomem *mmio); 300 void __iomem *mmio);
@@ -322,7 +323,8 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
322static void mv_eng_timeout(struct ata_port *ap); 323static void mv_eng_timeout(struct ata_port *ap);
323static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 324static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
324 325
325static void mv5_phy_errata(struct ata_port *ap); 326static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
327 unsigned int port);
326static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); 328static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
327static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, 329static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx,
328 void __iomem *mmio); 330 void __iomem *mmio);
@@ -330,7 +332,8 @@ static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio);
330static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); 332static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio);
331static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); 333static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio);
332 334
333static void mv6_phy_errata(struct ata_port *ap); 335static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
336 unsigned int port);
334static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); 337static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
335static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, 338static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
336 void __iomem *mmio); 339 void __iomem *mmio);
@@ -1275,7 +1278,8 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
1275 writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); 1278 writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL);
1276} 1279}
1277 1280
1278static void mv5_phy_errata(struct ata_port *ap) 1281static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
1282 unsigned int port)
1279{ 1283{
1280 /* FIXME */ 1284 /* FIXME */
1281} 1285}
@@ -1411,11 +1415,10 @@ static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio)
1411 writel(0x00000060, mmio + MV_GPIO_PORT_CTL); 1415 writel(0x00000060, mmio + MV_GPIO_PORT_CTL);
1412} 1416}
1413 1417
1414static void mv6_phy_errata(struct ata_port *ap) 1418static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *port_mmio,
1419 unsigned int port)
1415{ 1420{
1416 struct mv_host_priv *hpriv = ap->host_set->private_data;
1417 u32 hp_flags = hpriv->hp_flags; 1421 u32 hp_flags = hpriv->hp_flags;
1418 void __iomem *port_mmio = mv_ap_base(ap);
1419 int fix_phy_mode2 = 1422 int fix_phy_mode2 =
1420 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); 1423 hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0);
1421 int fix_phy_mode4 = 1424 int fix_phy_mode4 =
@@ -1463,8 +1466,8 @@ static void mv6_phy_errata(struct ata_port *ap)
1463 m2 = readl(port_mmio + PHY_MODE2); 1466 m2 = readl(port_mmio + PHY_MODE2);
1464 1467
1465 m2 &= ~MV_M2_PREAMP_MASK; 1468 m2 &= ~MV_M2_PREAMP_MASK;
1466 m2 |= hpriv->signal[ap->port_no].amps; 1469 m2 |= hpriv->signal[port].amps;
1467 m2 |= hpriv->signal[ap->port_no].pre; 1470 m2 |= hpriv->signal[port].pre;
1468 m2 &= ~(1 << 16); 1471 m2 &= ~(1 << 16);
1469 1472
1470 writel(m2, port_mmio + PHY_MODE2); 1473 writel(m2, port_mmio + PHY_MODE2);
@@ -1509,7 +1512,7 @@ static void mv_phy_reset(struct ata_port *ap)
1509 */ 1512 */
1510 writelfl(0, port_mmio + EDMA_CMD_OFS); 1513 writelfl(0, port_mmio + EDMA_CMD_OFS);
1511 1514
1512 hpriv->ops->phy_errata(ap); 1515 hpriv->ops->phy_errata(hpriv, port_mmio, ap->port_no);
1513 1516
1514 DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " 1517 DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x "
1515 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), 1518 "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS),
@@ -1747,7 +1750,6 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent,
1747{ 1750{
1748 int rc = 0, n_hc, port, hc; 1751 int rc = 0, n_hc, port, hc;
1749 void __iomem *mmio = probe_ent->mmio_base; 1752 void __iomem *mmio = probe_ent->mmio_base;
1750 void __iomem *port_mmio;
1751 struct mv_host_priv *hpriv = probe_ent->private_data; 1753 struct mv_host_priv *hpriv = probe_ent->private_data;
1752 1754
1753 /* global interrupt mask */ 1755 /* global interrupt mask */
@@ -1772,7 +1774,19 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent,
1772 hpriv->ops->enable_leds(hpriv, mmio); 1774 hpriv->ops->enable_leds(hpriv, mmio);
1773 1775
1774 for (port = 0; port < probe_ent->n_ports; port++) { 1776 for (port = 0; port < probe_ent->n_ports; port++) {
1775 port_mmio = mv_port_base(mmio, port); 1777 void __iomem *port_mmio = mv_port_base(mmio, port);
1778
1779 if (IS_60XX(hpriv)) {
1780 u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);
1781 ifctl |= (1 << 12);
1782 writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);
1783 }
1784
1785 hpriv->ops->phy_errata(hpriv, port_mmio, port);
1786 }
1787
1788 for (port = 0; port < probe_ent->n_ports; port++) {
1789 void __iomem *port_mmio = mv_port_base(mmio, port);
1776 mv_port_init(&probe_ent->port[port], port_mmio); 1790 mv_port_init(&probe_ent->port[port], port_mmio);
1777 } 1791 }
1778 1792