davinci_emac: Support the get_ts_info ethtool method.
[deliverable/linux.git] / drivers / net / ethernet / ti / davinci_emac.c
index 4b2f54565f64adece3f69b5a89b7997666ce16e5..8aa33326bec3507d07ed0d3c9b46dab081023996 100644 (file)
@@ -627,6 +627,7 @@ static const struct ethtool_ops ethtool_ops = {
        .get_link = ethtool_op_get_link,
        .get_coalesce = emac_get_coalesce,
        .set_coalesce =  emac_set_coalesce,
+       .get_ts_info = ethtool_op_get_ts_info,
 };
 
 /**
@@ -992,10 +993,9 @@ static irqreturn_t emac_irq(int irq, void *dev_id)
 
 static struct sk_buff *emac_rx_alloc(struct emac_priv *priv)
 {
-       struct sk_buff *skb = dev_alloc_skb(priv->rx_buf_size);
+       struct sk_buff *skb = netdev_alloc_skb(priv->ndev, priv->rx_buf_size);
        if (WARN_ON(!skb))
                return NULL;
-       skb->dev = priv->ndev;
        skb_reserve(skb, NET_IP_ALIGN);
        return skb;
 }
@@ -1257,15 +1257,15 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr)
        struct sockaddr *sa = addr;
 
        if (!is_valid_ether_addr(sa->sa_data))
-               return -EINVAL;
+               return -EADDRNOTAVAIL;
 
        /* Store mac addr in priv and rx channel and set it in EMAC hw */
        memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len);
        memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len);
+       ndev->addr_assign_type &= ~NET_ADDR_RANDOM;
 
        /* MAC address is configured only after the interface is enabled. */
        if (netif_running(ndev)) {
-               memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len);
                emac_setmac(priv, EMAC_DEF_RX_CH, priv->mac_addr);
        }
 
@@ -1792,7 +1792,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        ndev = alloc_etherdev(sizeof(struct emac_priv));
        if (!ndev) {
-               dev_err(&pdev->dev, "error allocating net_device\n");
                rc = -ENOMEM;
                goto free_clk;
        }
@@ -1900,7 +1899,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 
        if (!is_valid_ether_addr(priv->mac_addr)) {
                /* Use random MAC if none passed */
-               random_ether_addr(priv->mac_addr);
+               eth_hw_addr_random(ndev);
+               memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
                dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
                                                        priv->mac_addr);
        }
This page took 0.024953 seconds and 5 git commands to generate.