diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
| -rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 4cbebf3d80eb..45b8b22b9987 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -98,10 +98,6 @@ static void set_multicast_list(struct net_device *ndev); | |||
| 98 | * detected as not set during a prior frame transmission, then the | 98 | * detected as not set during a prior frame transmission, then the |
| 99 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | 99 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs |
| 100 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | 100 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in |
| 101 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
| 102 | * detected as not set during a prior frame transmission, then the | ||
| 103 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
| 104 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
| 105 | * frames not being transmitted until there is a 0-to-1 transition on | 101 | * frames not being transmitted until there is a 0-to-1 transition on |
| 106 | * ENET_TDAR[TDAR]. | 102 | * ENET_TDAR[TDAR]. |
| 107 | */ | 103 | */ |
| @@ -385,7 +381,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 385 | * data. | 381 | * data. |
| 386 | */ | 382 | */ |
| 387 | bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, | 383 | bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, |
| 388 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | 384 | skb->len, DMA_TO_DEVICE); |
| 389 | if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) { | 385 | if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) { |
| 390 | bdp->cbd_bufaddr = 0; | 386 | bdp->cbd_bufaddr = 0; |
| 391 | fep->tx_skbuff[index] = NULL; | 387 | fep->tx_skbuff[index] = NULL; |
| @@ -432,6 +428,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 432 | /* If this was the last BD in the ring, start at the beginning again. */ | 428 | /* If this was the last BD in the ring, start at the beginning again. */ |
| 433 | bdp = fec_enet_get_nextdesc(bdp, fep); | 429 | bdp = fec_enet_get_nextdesc(bdp, fep); |
| 434 | 430 | ||
| 431 | skb_tx_timestamp(skb); | ||
| 432 | |||
| 435 | fep->cur_tx = bdp; | 433 | fep->cur_tx = bdp; |
| 436 | 434 | ||
| 437 | if (fep->cur_tx == fep->dirty_tx) | 435 | if (fep->cur_tx == fep->dirty_tx) |
| @@ -440,8 +438,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 440 | /* Trigger transmission start */ | 438 | /* Trigger transmission start */ |
| 441 | writel(0, fep->hwp + FEC_X_DES_ACTIVE); | 439 | writel(0, fep->hwp + FEC_X_DES_ACTIVE); |
| 442 | 440 | ||
| 443 | skb_tx_timestamp(skb); | ||
| 444 | |||
| 445 | return NETDEV_TX_OK; | 441 | return NETDEV_TX_OK; |
| 446 | } | 442 | } |
| 447 | 443 | ||
| @@ -779,11 +775,10 @@ fec_enet_tx(struct net_device *ndev) | |||
| 779 | else | 775 | else |
| 780 | index = bdp - fep->tx_bd_base; | 776 | index = bdp - fep->tx_bd_base; |
| 781 | 777 | ||
| 782 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
| 783 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | ||
| 784 | bdp->cbd_bufaddr = 0; | ||
| 785 | |||
| 786 | skb = fep->tx_skbuff[index]; | 778 | skb = fep->tx_skbuff[index]; |
| 779 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, skb->len, | ||
| 780 | DMA_TO_DEVICE); | ||
| 781 | bdp->cbd_bufaddr = 0; | ||
| 787 | 782 | ||
| 788 | /* Check for errors. */ | 783 | /* Check for errors. */ |
| 789 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | | 784 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | |
| @@ -2054,6 +2049,8 @@ static void fec_reset_phy(struct platform_device *pdev) | |||
| 2054 | int err, phy_reset; | 2049 | int err, phy_reset; |
| 2055 | int msec = 1; | 2050 | int msec = 1; |
| 2056 | struct device_node *np = pdev->dev.of_node; | 2051 | struct device_node *np = pdev->dev.of_node; |
| 2052 | enum of_gpio_flags flags; | ||
| 2053 | bool port; | ||
| 2057 | 2054 | ||
| 2058 | if (!np) | 2055 | if (!np) |
| 2059 | return; | 2056 | return; |
| @@ -2063,18 +2060,22 @@ static void fec_reset_phy(struct platform_device *pdev) | |||
| 2063 | if (msec > 1000) | 2060 | if (msec > 1000) |
| 2064 | msec = 1; | 2061 | msec = 1; |
| 2065 | 2062 | ||
| 2066 | phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); | 2063 | phy_reset = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags); |
| 2067 | if (!gpio_is_valid(phy_reset)) | 2064 | if (!gpio_is_valid(phy_reset)) |
| 2068 | return; | 2065 | return; |
| 2069 | 2066 | ||
| 2070 | err = devm_gpio_request_one(&pdev->dev, phy_reset, | 2067 | if (flags & OF_GPIO_ACTIVE_LOW) |
| 2071 | GPIOF_OUT_INIT_LOW, "phy-reset"); | 2068 | port = GPIOF_OUT_INIT_LOW; |
| 2069 | else | ||
| 2070 | port = GPIOF_OUT_INIT_HIGH; | ||
| 2071 | |||
| 2072 | err = devm_gpio_request_one(&pdev->dev, phy_reset, port, "phy-reset"); | ||
| 2072 | if (err) { | 2073 | if (err) { |
| 2073 | dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err); | 2074 | dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err); |
| 2074 | return; | 2075 | return; |
| 2075 | } | 2076 | } |
| 2076 | msleep(msec); | 2077 | msleep(msec); |
| 2077 | gpio_set_value(phy_reset, 1); | 2078 | gpio_set_value(phy_reset, !port); |
| 2078 | } | 2079 | } |
| 2079 | #else /* CONFIG_OF */ | 2080 | #else /* CONFIG_OF */ |
| 2080 | static void fec_reset_phy(struct platform_device *pdev) | 2081 | static void fec_reset_phy(struct platform_device *pdev) |
