diff options
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index c6791cd4ee05..28b53d1cd4f1 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -381,10 +381,14 @@ static void gfar_init_mac(struct net_device *ndev) | |||
381 | /* Insert receive time stamps into padding alignment bytes */ | 381 | /* Insert receive time stamps into padding alignment bytes */ |
382 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { | 382 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { |
383 | rctrl &= ~RCTRL_PAL_MASK; | 383 | rctrl &= ~RCTRL_PAL_MASK; |
384 | rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8); | 384 | rctrl |= RCTRL_PADDING(8); |
385 | priv->padding = 8; | 385 | priv->padding = 8; |
386 | } | 386 | } |
387 | 387 | ||
388 | /* Enable HW time stamping if requested from user space */ | ||
389 | if (priv->hwts_rx_en) | ||
390 | rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE; | ||
391 | |||
388 | /* keep vlan related bits if it's enabled */ | 392 | /* keep vlan related bits if it's enabled */ |
389 | if (priv->vlgrp) { | 393 | if (priv->vlgrp) { |
390 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; | 394 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; |
@@ -608,7 +612,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | |||
608 | int err = 0, i; | 612 | int err = 0, i; |
609 | struct net_device *dev = NULL; | 613 | struct net_device *dev = NULL; |
610 | struct gfar_private *priv = NULL; | 614 | struct gfar_private *priv = NULL; |
611 | struct device_node *np = ofdev->node; | 615 | struct device_node *np = ofdev->dev.of_node; |
612 | struct device_node *child = NULL; | 616 | struct device_node *child = NULL; |
613 | const u32 *stash; | 617 | const u32 *stash; |
614 | const u32 *stash_len; | 618 | const u32 *stash_len; |
@@ -646,7 +650,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | |||
646 | return -ENOMEM; | 650 | return -ENOMEM; |
647 | 651 | ||
648 | priv = netdev_priv(dev); | 652 | priv = netdev_priv(dev); |
649 | priv->node = ofdev->node; | 653 | priv->node = ofdev->dev.of_node; |
650 | priv->ndev = dev; | 654 | priv->ndev = dev; |
651 | 655 | ||
652 | dev->num_tx_queues = num_tx_qs; | 656 | dev->num_tx_queues = num_tx_qs; |
@@ -806,12 +810,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev, | |||
806 | 810 | ||
807 | switch (config.rx_filter) { | 811 | switch (config.rx_filter) { |
808 | case HWTSTAMP_FILTER_NONE: | 812 | case HWTSTAMP_FILTER_NONE: |
809 | priv->hwts_rx_en = 0; | 813 | if (priv->hwts_rx_en) { |
814 | stop_gfar(netdev); | ||
815 | priv->hwts_rx_en = 0; | ||
816 | startup_gfar(netdev); | ||
817 | } | ||
810 | break; | 818 | break; |
811 | default: | 819 | default: |
812 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) | 820 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) |
813 | return -ERANGE; | 821 | return -ERANGE; |
814 | priv->hwts_rx_en = 1; | 822 | if (!priv->hwts_rx_en) { |
823 | stop_gfar(netdev); | ||
824 | priv->hwts_rx_en = 1; | ||
825 | startup_gfar(netdev); | ||
826 | } | ||
815 | config.rx_filter = HWTSTAMP_FILTER_ALL; | 827 | config.rx_filter = HWTSTAMP_FILTER_ALL; |
816 | break; | 828 | break; |
817 | } | 829 | } |
@@ -939,7 +951,7 @@ static int gfar_probe(struct of_device *ofdev, | |||
939 | priv = netdev_priv(dev); | 951 | priv = netdev_priv(dev); |
940 | priv->ndev = dev; | 952 | priv->ndev = dev; |
941 | priv->ofdev = ofdev; | 953 | priv->ofdev = ofdev; |
942 | priv->node = ofdev->node; | 954 | priv->node = ofdev->dev.of_node; |
943 | SET_NETDEV_DEV(dev, &ofdev->dev); | 955 | SET_NETDEV_DEV(dev, &ofdev->dev); |
944 | 956 | ||
945 | spin_lock_init(&priv->bflock); | 957 | spin_lock_init(&priv->bflock); |
@@ -2643,6 +2655,10 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2643 | dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, | 2655 | dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, |
2644 | priv->rx_buffer_size, DMA_FROM_DEVICE); | 2656 | priv->rx_buffer_size, DMA_FROM_DEVICE); |
2645 | 2657 | ||
2658 | if (unlikely(!(bdp->status & RXBD_ERR) && | ||
2659 | bdp->length > priv->rx_buffer_size)) | ||
2660 | bdp->status = RXBD_LARGE; | ||
2661 | |||
2646 | /* We drop the frame if we failed to allocate a new buffer */ | 2662 | /* We drop the frame if we failed to allocate a new buffer */ |
2647 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || | 2663 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || |
2648 | bdp->status & RXBD_ERR)) { | 2664 | bdp->status & RXBD_ERR)) { |
@@ -3167,12 +3183,14 @@ MODULE_DEVICE_TABLE(of, gfar_match); | |||
3167 | 3183 | ||
3168 | /* Structure for a device driver */ | 3184 | /* Structure for a device driver */ |
3169 | static struct of_platform_driver gfar_driver = { | 3185 | static struct of_platform_driver gfar_driver = { |
3170 | .name = "fsl-gianfar", | 3186 | .driver = { |
3171 | .match_table = gfar_match, | 3187 | .name = "fsl-gianfar", |
3172 | 3188 | .owner = THIS_MODULE, | |
3189 | .pm = GFAR_PM_OPS, | ||
3190 | .of_match_table = gfar_match, | ||
3191 | }, | ||
3173 | .probe = gfar_probe, | 3192 | .probe = gfar_probe, |
3174 | .remove = gfar_remove, | 3193 | .remove = gfar_remove, |
3175 | .driver.pm = GFAR_PM_OPS, | ||
3176 | }; | 3194 | }; |
3177 | 3195 | ||
3178 | static int __init gfar_init(void) | 3196 | static int __init gfar_init(void) |