net: Make GRETH driver depend on SPARC.
[safe/jmp/linux-2.6] / drivers / net / ll_temac_main.c
index 96e7248..e534402 100644 (file)
@@ -134,7 +134,7 @@ static int temac_dma_bd_init(struct net_device *ndev)
        struct sk_buff *skb;
        int i;
 
-       lp->rx_skb = kzalloc(sizeof(struct sk_buff)*RX_BD_NUM, GFP_KERNEL);
+       lp->rx_skb = kzalloc(sizeof(*lp->rx_skb) * RX_BD_NUM, GFP_KERNEL);
        /* allocate the tx and rx ring buffer descriptors. */
        /* returns a virtual addres and a physical address. */
        lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
@@ -224,6 +224,13 @@ static int temac_set_mac_address(struct net_device *ndev, void *address)
        return 0;
 }
 
+static int netdev_set_mac_address(struct net_device *ndev, void *p)
+{
+       struct sockaddr *addr = p;
+
+       return temac_set_mac_address(ndev, addr->sa_data);
+}
+
 static void temac_set_multicast_list(struct net_device *ndev)
 {
        struct temac_local *lp = netdev_priv(ndev);
@@ -231,8 +238,8 @@ static void temac_set_multicast_list(struct net_device *ndev)
        int i;
 
        mutex_lock(&lp->indirect_mutex);
-       if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC)
-                       || ndev->mc_count > MULTICAST_CAM_TABLE_NUM) {
+       if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) ||
+           netdev_mc_count(ndev) > MULTICAST_CAM_TABLE_NUM) {
                /*
                 *      We must make the kernel realise we had to move
                 *      into promisc mode or we start all out war on
@@ -242,9 +249,9 @@ static void temac_set_multicast_list(struct net_device *ndev)
                ndev->flags |= IFF_PROMISC;
                temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
                dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
-       } else if (ndev->mc_count) {
+       } else if (!netdev_mc_empty(ndev)) {
                struct dev_mc_list *mclist = ndev->mc_list;
-               for (i = 0; mclist && i < ndev->mc_count; i++) {
+               for (i = 0; mclist && i < netdev_mc_count(ndev); i++) {
 
                        if (i >= MULTICAST_CAM_TABLE_NUM)
                                break;
@@ -591,7 +598,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        /* Kick off the transfer */
        temac_dma_out32(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 
@@ -615,7 +622,7 @@ static void ll_temac_recv(struct net_device *ndev)
        while ((bdstat & STS_CTRL_APP0_CMPLT)) {
 
                skb = lp->rx_skb[lp->rx_bd_ci];
-               length = cur_p->app4;
+               length = cur_p->app4 & 0x3FFF;
 
                skb_vaddr = virt_to_bus(skb->data);
                dma_unmap_single(ndev->dev.parent, skb_vaddr, length,
@@ -768,7 +775,7 @@ static const struct net_device_ops temac_netdev_ops = {
        .ndo_open = temac_open,
        .ndo_stop = temac_stop,
        .ndo_start_xmit = temac_start_xmit,
-       .ndo_set_mac_address = temac_set_mac_address,
+       .ndo_set_mac_address = netdev_set_mac_address,
        //.ndo_set_multicast_list = temac_set_multicast_list,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller = temac_poll_controller,
@@ -865,7 +872,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
        dcrs = dcr_resource_start(np, 0);
        if (dcrs == 0) {
                dev_err(&op->dev, "could not get DMA register address\n");
-               goto nodev;;
+               goto nodev;
        }
        lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
        dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
@@ -938,6 +945,9 @@ static int __devexit temac_of_remove(struct of_device *op)
 
 static struct of_device_id temac_of_match[] __devinitdata = {
        { .compatible = "xlnx,xps-ll-temac-1.01.b", },
+       { .compatible = "xlnx,xps-ll-temac-2.00.a", },
+       { .compatible = "xlnx,xps-ll-temac-2.02.a", },
+       { .compatible = "xlnx,xps-ll-temac-2.03.a", },
        {},
 };
 MODULE_DEVICE_TABLE(of, temac_of_match);