Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192474
b: refs/heads/master
c: ce6e74f
h: refs/heads/master
v: v3
  • Loading branch information
Chien Tung authored and Roland Dreier committed Apr 21, 2010
1 parent 18cdbf5 commit 3d25ec9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 29 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: 3a2baff783497321e8322ce29f3a33a21c0d88f5
refs/heads/master: ce6e74f23d8018f50609f694b6177c139486ebe5
8 changes: 4 additions & 4 deletions trunk/drivers/infiniband/hw/mthca/mthca_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct,
if (!buf->direct.buf)
return -ENOMEM;

dma_unmap_addr_set(&buf->direct, mapping, t);
pci_unmap_addr_set(&buf->direct, mapping, t);

memset(buf->direct.buf, 0, size);

Expand Down Expand Up @@ -251,7 +251,7 @@ int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct,
goto err_free;

dma_list[i] = t;
dma_unmap_addr_set(&buf->page_list[i], mapping, t);
pci_unmap_addr_set(&buf->page_list[i], mapping, t);

clear_page(buf->page_list[i].buf);
}
Expand Down Expand Up @@ -289,12 +289,12 @@ void mthca_buf_free(struct mthca_dev *dev, int size, union mthca_buf *buf,

if (is_direct)
dma_free_coherent(&dev->pdev->dev, size, buf->direct.buf,
dma_unmap_addr(&buf->direct, mapping));
pci_unmap_addr(&buf->direct, mapping));
else {
for (i = 0; i < (size + PAGE_SIZE - 1) / PAGE_SIZE; ++i)
dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
buf->page_list[i].buf,
dma_unmap_addr(&buf->page_list[i],
pci_unmap_addr(&buf->page_list[i],
mapping));
kfree(buf->page_list);
}
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/infiniband/hw/mthca/mthca_eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static int mthca_create_eq(struct mthca_dev *dev,
goto err_out_free_pages;

dma_list[i] = t;
dma_unmap_addr_set(&eq->page_list[i], mapping, t);
pci_unmap_addr_set(&eq->page_list[i], mapping, t);

clear_page(eq->page_list[i].buf);
}
Expand Down Expand Up @@ -579,7 +579,7 @@ static int mthca_create_eq(struct mthca_dev *dev,
if (eq->page_list[i].buf)
dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
eq->page_list[i].buf,
dma_unmap_addr(&eq->page_list[i],
pci_unmap_addr(&eq->page_list[i],
mapping));

mthca_free_mailbox(dev, mailbox);
Expand Down Expand Up @@ -629,7 +629,7 @@ static void mthca_free_eq(struct mthca_dev *dev,
for (i = 0; i < npages; ++i)
pci_free_consistent(dev->pdev, PAGE_SIZE,
eq->page_list[i].buf,
dma_unmap_addr(&eq->page_list[i], mapping));
pci_unmap_addr(&eq->page_list[i], mapping));

kfree(eq->page_list);
mthca_free_mailbox(dev, mailbox);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/infiniband/hw/mthca/mthca_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

struct mthca_buf_list {
void *buf;
DEFINE_DMA_UNMAP_ADDR(mapping);
DECLARE_PCI_UNMAP_ADDR(mapping)
};

union mthca_buf {
Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/infiniband/hw/nes/nes_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,6 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number)
return;
}
nesadapter->mac_sw_state[mac_number] = NES_MAC_SW_INTERRUPT;
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);

/* ack the MAC interrupt */
mac_status = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (mac_index * 0x200));
Expand All @@ -2469,11 +2468,9 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number)

if (mac_status & (NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT)) {
nesdev->link_status_interrupts++;
if (0 == (++nesadapter->link_interrupt_count[mac_index] % ((u16)NES_MAX_LINK_INTERRUPTS))) {
spin_lock_irqsave(&nesadapter->phy_lock, flags);
if (0 == (++nesadapter->link_interrupt_count[mac_index] % ((u16)NES_MAX_LINK_INTERRUPTS)))
nes_reset_link(nesdev, mac_index);
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}

/* read the PHY interrupt status register */
if ((nesadapter->OneG_Mode) &&
(nesadapter->phy_type[mac_index] != NES_PHY_TYPE_PUMA_1G)) {
Expand Down Expand Up @@ -2587,6 +2584,7 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number)
break;
}
}
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);

if (phy_data & 0x0004) {
if (wide_ppm_offset &&
Expand Down
16 changes: 11 additions & 5 deletions trunk/drivers/infiniband/hw/nes/nes_nic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,11 +1461,14 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
et_cmd->transceiver = XCVR_INTERNAL;
et_cmd->phy_address = mac_index;
} else {
unsigned long flags;
et_cmd->supported = SUPPORTED_1000baseT_Full
| SUPPORTED_Autoneg;
et_cmd->advertising = ADVERTISED_1000baseT_Full
| ADVERTISED_Autoneg;
spin_lock_irqsave(&nesadapter->phy_lock, flags);
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
if (phy_data & 0x1000)
et_cmd->autoneg = AUTONEG_ENABLE;
else
Expand Down Expand Up @@ -1503,21 +1506,24 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
struct nes_vnic *nesvnic = netdev_priv(netdev);
struct nes_device *nesdev = nesvnic->nesdev;
struct nes_adapter *nesadapter = nesdev->nesadapter;
u16 phy_data;

if ((nesadapter->OneG_Mode) &&
(nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_PUMA_1G)) {
nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index],
&phy_data);
unsigned long flags;
u16 phy_data;
u8 phy_index = nesadapter->phy_index[nesdev->mac_index];

spin_lock_irqsave(&nesadapter->phy_lock, flags);
nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
if (et_cmd->autoneg) {
/* Turn on Full duplex, Autoneg, and restart autonegotiation */
phy_data |= 0x1300;
} else {
/* Turn off autoneg */
phy_data &= ~0x1000;
}
nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index],
phy_data);
nes_write_1G_phy_reg(nesdev, 0, phy_index, phy_data);
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}

return 0;
Expand Down
10 changes: 0 additions & 10 deletions trunk/drivers/infiniband/hw/nes/nes_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,8 @@ static u16 nes_read16_eeprom(void __iomem *addr, u16 offset)
*/
void nes_write_1G_phy_reg(struct nes_device *nesdev, u8 phy_reg, u8 phy_addr, u16 data)
{
struct nes_adapter *nesadapter = nesdev->nesadapter;
u32 u32temp;
u32 counter;
unsigned long flags;

spin_lock_irqsave(&nesadapter->phy_lock, flags);

nes_write_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL,
0x50020000 | data | ((u32)phy_reg << 18) | ((u32)phy_addr << 23));
Expand All @@ -402,8 +398,6 @@ void nes_write_1G_phy_reg(struct nes_device *nesdev, u8 phy_reg, u8 phy_addr, u1
if (!(u32temp & 1))
nes_debug(NES_DBG_PHY, "Phy is not responding. interrupt status = 0x%X.\n",
u32temp);

spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}


Expand All @@ -414,14 +408,11 @@ void nes_write_1G_phy_reg(struct nes_device *nesdev, u8 phy_reg, u8 phy_addr, u1
*/
void nes_read_1G_phy_reg(struct nes_device *nesdev, u8 phy_reg, u8 phy_addr, u16 *data)
{
struct nes_adapter *nesadapter = nesdev->nesadapter;
u32 u32temp;
u32 counter;
unsigned long flags;

/* nes_debug(NES_DBG_PHY, "phy addr = %d, mac_index = %d\n",
phy_addr, nesdev->mac_index); */
spin_lock_irqsave(&nesadapter->phy_lock, flags);

nes_write_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL,
0x60020000 | ((u32)phy_reg << 18) | ((u32)phy_addr << 23));
Expand All @@ -441,7 +432,6 @@ void nes_read_1G_phy_reg(struct nes_device *nesdev, u8 phy_reg, u8 phy_addr, u16
} else {
*data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL);
}
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
}


Expand Down

0 comments on commit 3d25ec9

Please sign in to comment.