serial: add support for the Lava Quattro PCI quad-port 16550A card
[safe/jmp/linux-2.6] / drivers / net / qla3xxx.c
index f188736..4c61051 100644 (file)
@@ -2284,7 +2284,6 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
 static int ql_poll(struct napi_struct *napi, int budget)
 {
        struct ql3_adapter *qdev = container_of(napi, struct ql3_adapter, napi);
-       struct net_device *ndev = qdev->ndev;
        int rx_cleaned = 0, tx_cleaned = 0;
        unsigned long hw_flags;
        struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
@@ -2293,7 +2292,7 @@ static int ql_poll(struct napi_struct *napi, int budget)
 
        if (tx_cleaned + rx_cleaned != budget) {
                spin_lock_irqsave(&qdev->hw_lock, hw_flags);
-               __netif_rx_complete(ndev, napi);
+               __napi_complete(napi);
                ql_update_small_bufq_prod_index(qdev);
                ql_update_lrg_bufq_prod_index(qdev);
                writel(qdev->rsp_consumer_index,
@@ -2352,8 +2351,8 @@ static irqreturn_t ql3xxx_isr(int irq, void *dev_id)
                spin_unlock(&qdev->adapter_lock);
        } else if (value & ISP_IMR_DISABLE_CMPL_INT) {
                ql_disable_interrupts(qdev);
-               if (likely(netif_rx_schedule_prep(ndev, &qdev->napi))) {
-                       __netif_rx_schedule(ndev, &qdev->napi);
+               if (likely(napi_schedule_prep(&qdev->napi))) {
+                       __napi_schedule(&qdev->napi);
                }
        } else {
                return IRQ_NONE;
@@ -2573,7 +2572,8 @@ map_error:
  * The IOCB is always the top of the chain followed by one or more
  * OALs (when necessary).
  */
-static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
+static netdev_tx_t ql3xxx_send(struct sk_buff *skb,
+                              struct net_device *ndev)
 {
        struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev);
        struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
@@ -2618,7 +2618,6 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
                            &port_regs->CommonRegs.reqQProducerIndex,
                            qdev->req_producer_index);
 
-       ndev->trans_start = jiffies;
        if (netif_msg_tx_queued(qdev))
                printk(KERN_DEBUG PFX "%s: tx queued, slot %d, len %d\n",
                       ndev->name, qdev->req_producer_index, skb->len);
@@ -3144,6 +3143,7 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
                                                (void __iomem *)port_regs;
        u32 delay = 10;
        int status = 0;
+       unsigned long hw_flags = 0;
 
        if(ql_mii_setup(qdev))
                return -1;
@@ -3152,7 +3152,8 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
        ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg,
                            (ISP_SERIAL_PORT_IF_WE |
                             (ISP_SERIAL_PORT_IF_WE << 16)));
-
+       /* Give the PHY time to come out of reset. */
+       mdelay(100);
        qdev->port_link_state = LS_DOWN;
        netif_carrier_off(qdev->ndev);
 
@@ -3352,7 +3353,9 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
                value = ql_read_page0_reg(qdev, &port_regs->portStatus);
                if (value & PORT_STATUS_IC)
                        break;
+               spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
                msleep(500);
+               spin_lock_irqsave(&qdev->hw_lock, hw_flags);
        } while (--delay);
 
        if (delay == 0) {
@@ -3839,7 +3842,9 @@ static void ql_reset_work(struct work_struct *work)
                                                      16) | ISP_CONTROL_RI));
                        }
 
+                       spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
                        ssleep(1);
+                       spin_lock_irqsave(&qdev->hw_lock, hw_flags);
                } while (--max_wait_time);
                spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 
@@ -3900,13 +3905,24 @@ static void ql3xxx_timer(unsigned long ptr)
        queue_delayed_work(qdev->workqueue, &qdev->link_state_work, 0);
 }
 
+static const struct net_device_ops ql3xxx_netdev_ops = {
+       .ndo_open               = ql3xxx_open,
+       .ndo_start_xmit         = ql3xxx_send,
+       .ndo_stop               = ql3xxx_close,
+       .ndo_set_multicast_list = NULL, /* not allowed on NIC side */
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = ql3xxx_set_mac_address,
+       .ndo_tx_timeout         = ql3xxx_tx_timeout,
+};
+
 static int __devinit ql3xxx_probe(struct pci_dev *pdev,
                                  const struct pci_device_id *pci_entry)
 {
        struct net_device *ndev = NULL;
        struct ql3_adapter *qdev = NULL;
        static int cards_found = 0;
-       int pci_using_dac, err;
+       int uninitialized_var(pci_using_dac), err;
 
        err = pci_enable_device(pdev);
        if (err) {
@@ -3924,12 +3940,12 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
 
        pci_set_master(pdev);
 
-       if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
+       if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
                pci_using_dac = 1;
-               err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
-       } else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
+               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
+       } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
                pci_using_dac = 0;
-               err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+               err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
        }
 
        if (err) {
@@ -3978,17 +3994,8 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
        spin_lock_init(&qdev->hw_lock);
 
        /* Set driver entry points */
-       ndev->open = ql3xxx_open;
-       ndev->hard_start_xmit = ql3xxx_send;
-       ndev->stop = ql3xxx_close;
-       /* ndev->set_multicast_list
-        * This device is one side of a two-function adapter
-        * (NIC and iSCSI).  Promiscuous mode setting/clearing is
-        * not allowed from the NIC side.
-        */
+       ndev->netdev_ops = &ql3xxx_netdev_ops;
        SET_ETHTOOL_OPS(ndev, &ql3xxx_ethtool_ops);
-       ndev->set_mac_address = ql3xxx_set_mac_address;
-       ndev->tx_timeout = ql3xxx_tx_timeout;
        ndev->watchdog_timeo = 5 * HZ;
 
        netif_napi_add(ndev, &qdev->napi, ql_poll, 64);