diff options
author | Amit Kumar Salecha <amit@qlogic.com> | 2009-10-16 11:50:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-18 02:44:40 -0400 |
commit | fb1f6a4378fe211d8c1397311d26e747e5ec61c5 (patch) | |
tree | 52c3c2b56b9887f920119c75c89cb7e4b0a0cef5 /drivers/net/netxen/netxen_nic_hw.c | |
parent | 0a2aa440603f27ad40bcc14806f4d87aabbd8a0f (diff) |
netxen: 128 memory controller support
Future revisions of the chip have 128 bit memory
transactions. Require drivers to implement rmw
in case of sub-128 bit accesses by driver. This
is mostly used by diagnostic tools.
Signed-off-by: Amit Kumar Salecha <amit@netxen.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index d067bee87cd5..52a2f2d67552 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1569,8 +1569,9 @@ static int | |||
1569 | netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | 1569 | netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, |
1570 | u64 off, u64 data) | 1570 | u64 off, u64 data) |
1571 | { | 1571 | { |
1572 | int j, ret; | 1572 | int i, j, ret; |
1573 | u32 temp, off8; | 1573 | u32 temp, off8; |
1574 | u64 stride; | ||
1574 | void __iomem *mem_crb; | 1575 | void __iomem *mem_crb; |
1575 | 1576 | ||
1576 | /* Only 64-bit aligned access */ | 1577 | /* Only 64-bit aligned access */ |
@@ -1597,14 +1598,45 @@ netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | |||
1597 | return -EIO; | 1598 | return -EIO; |
1598 | 1599 | ||
1599 | correct: | 1600 | correct: |
1600 | off8 = off & MIU_TEST_AGT_ADDR_MASK; | 1601 | stride = NX_IS_REVISION_P3P(adapter->ahw.revision_id) ? 16 : 8; |
1602 | |||
1603 | off8 = off & ~(stride-1); | ||
1601 | 1604 | ||
1602 | spin_lock(&adapter->ahw.mem_lock); | 1605 | spin_lock(&adapter->ahw.mem_lock); |
1603 | 1606 | ||
1604 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); | 1607 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); |
1605 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); | 1608 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); |
1606 | writel(data & 0xffffffff, mem_crb + MIU_TEST_AGT_WRDATA_LO); | 1609 | |
1607 | writel((data >> 32) & 0xffffffff, mem_crb + MIU_TEST_AGT_WRDATA_HI); | 1610 | i = 0; |
1611 | if (stride == 16) { | ||
1612 | writel(TA_CTL_ENABLE, (mem_crb + TEST_AGT_CTRL)); | ||
1613 | writel((TA_CTL_START | TA_CTL_ENABLE), | ||
1614 | (mem_crb + TEST_AGT_CTRL)); | ||
1615 | |||
1616 | for (j = 0; j < MAX_CTL_CHECK; j++) { | ||
1617 | temp = readl(mem_crb + TEST_AGT_CTRL); | ||
1618 | if ((temp & TA_CTL_BUSY) == 0) | ||
1619 | break; | ||
1620 | } | ||
1621 | |||
1622 | if (j >= MAX_CTL_CHECK) { | ||
1623 | ret = -EIO; | ||
1624 | goto done; | ||
1625 | } | ||
1626 | |||
1627 | i = (off & 0xf) ? 0 : 2; | ||
1628 | writel(readl(mem_crb + MIU_TEST_AGT_RDDATA(i)), | ||
1629 | mem_crb + MIU_TEST_AGT_WRDATA(i)); | ||
1630 | writel(readl(mem_crb + MIU_TEST_AGT_RDDATA(i+1)), | ||
1631 | mem_crb + MIU_TEST_AGT_WRDATA(i+1)); | ||
1632 | i = (off & 0xf) ? 2 : 0; | ||
1633 | } | ||
1634 | |||
1635 | writel(data & 0xffffffff, | ||
1636 | mem_crb + MIU_TEST_AGT_WRDATA(i)); | ||
1637 | writel((data >> 32) & 0xffffffff, | ||
1638 | mem_crb + MIU_TEST_AGT_WRDATA(i+1)); | ||
1639 | |||
1608 | writel((TA_CTL_ENABLE | TA_CTL_WRITE), (mem_crb + TEST_AGT_CTRL)); | 1640 | writel((TA_CTL_ENABLE | TA_CTL_WRITE), (mem_crb + TEST_AGT_CTRL)); |
1609 | writel((TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE), | 1641 | writel((TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE), |
1610 | (mem_crb + TEST_AGT_CTRL)); | 1642 | (mem_crb + TEST_AGT_CTRL)); |
@@ -1623,6 +1655,7 @@ correct: | |||
1623 | } else | 1655 | } else |
1624 | ret = 0; | 1656 | ret = 0; |
1625 | 1657 | ||
1658 | done: | ||
1626 | spin_unlock(&adapter->ahw.mem_lock); | 1659 | spin_unlock(&adapter->ahw.mem_lock); |
1627 | 1660 | ||
1628 | return ret; | 1661 | return ret; |
@@ -1634,7 +1667,7 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, | |||
1634 | { | 1667 | { |
1635 | int j, ret; | 1668 | int j, ret; |
1636 | u32 temp, off8; | 1669 | u32 temp, off8; |
1637 | u64 val; | 1670 | u64 val, stride; |
1638 | void __iomem *mem_crb; | 1671 | void __iomem *mem_crb; |
1639 | 1672 | ||
1640 | /* Only 64-bit aligned access */ | 1673 | /* Only 64-bit aligned access */ |
@@ -1663,7 +1696,9 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, | |||
1663 | return -EIO; | 1696 | return -EIO; |
1664 | 1697 | ||
1665 | correct: | 1698 | correct: |
1666 | off8 = off & MIU_TEST_AGT_ADDR_MASK; | 1699 | stride = NX_IS_REVISION_P3P(adapter->ahw.revision_id) ? 16 : 8; |
1700 | |||
1701 | off8 = off & ~(stride-1); | ||
1667 | 1702 | ||
1668 | spin_lock(&adapter->ahw.mem_lock); | 1703 | spin_lock(&adapter->ahw.mem_lock); |
1669 | 1704 | ||
@@ -1684,9 +1719,13 @@ correct: | |||
1684 | "failed to read through agent\n"); | 1719 | "failed to read through agent\n"); |
1685 | ret = -EIO; | 1720 | ret = -EIO; |
1686 | } else { | 1721 | } else { |
1687 | temp = readl(mem_crb + MIU_TEST_AGT_RDDATA_HI); | 1722 | off8 = MIU_TEST_AGT_RDDATA_LO; |
1723 | if ((stride == 16) && (off & 0xf)) | ||
1724 | off8 = MIU_TEST_AGT_RDDATA_UPPER_LO; | ||
1725 | |||
1726 | temp = readl(mem_crb + off8 + 4); | ||
1688 | val = (u64)temp << 32; | 1727 | val = (u64)temp << 32; |
1689 | val |= readl(mem_crb + MIU_TEST_AGT_RDDATA_LO); | 1728 | val |= readl(mem_crb + off8); |
1690 | *data = val; | 1729 | *data = val; |
1691 | ret = 0; | 1730 | ret = 0; |
1692 | } | 1731 | } |