diff options
author | David S. Miller <davem@davemloft.net> | 2015-03-02 21:31:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-02 21:31:00 -0500 |
commit | 096b1c172853163b865884446f73977b27eb034d (patch) | |
tree | 3499adf3aa71c7c60806d715a7fc84828bd83cdf | |
parent | eee617a1c35dbf598690879f13dc3df548fd6ea6 (diff) | |
parent | dacc73e0cf930e87e2e6a94d29156f1d5776b18f (diff) |
Merge branch 'sh_eth'
Ben Hutchings says:
====================
Fixes for sh_eth #4 v2
I'm continuing review and testing of Ethernet support on the R-Car H2
chip, with help from a colleague. This series fixes a few more issues.
These are not tested on any of the other supported chips.
v2: Add note that the revert is not a pure revert.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 654b48d1e61a..736d5d1624a1 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -508,7 +508,6 @@ static struct sh_eth_cpu_data r8a779x_data = { | |||
508 | .tpauser = 1, | 508 | .tpauser = 1, |
509 | .hw_swap = 1, | 509 | .hw_swap = 1, |
510 | .rmiimode = 1, | 510 | .rmiimode = 1, |
511 | .shift_rd0 = 1, | ||
512 | }; | 511 | }; |
513 | 512 | ||
514 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) | 513 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) |
@@ -1410,6 +1409,8 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
1410 | txdesc = &mdp->tx_ring[entry]; | 1409 | txdesc = &mdp->tx_ring[entry]; |
1411 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) | 1410 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) |
1412 | break; | 1411 | break; |
1412 | /* TACT bit must be checked before all the following reads */ | ||
1413 | rmb(); | ||
1413 | /* Free the original skb. */ | 1414 | /* Free the original skb. */ |
1414 | if (mdp->tx_skbuff[entry]) { | 1415 | if (mdp->tx_skbuff[entry]) { |
1415 | dma_unmap_single(&ndev->dev, txdesc->addr, | 1416 | dma_unmap_single(&ndev->dev, txdesc->addr, |
@@ -1447,6 +1448,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1447 | limit = boguscnt; | 1448 | limit = boguscnt; |
1448 | rxdesc = &mdp->rx_ring[entry]; | 1449 | rxdesc = &mdp->rx_ring[entry]; |
1449 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { | 1450 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { |
1451 | /* RACT bit must be checked before all the following reads */ | ||
1452 | rmb(); | ||
1450 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1453 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
1451 | pkt_len = rxdesc->frame_length; | 1454 | pkt_len = rxdesc->frame_length; |
1452 | 1455 | ||
@@ -1458,8 +1461,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1458 | 1461 | ||
1459 | /* In case of almost all GETHER/ETHERs, the Receive Frame State | 1462 | /* In case of almost all GETHER/ETHERs, the Receive Frame State |
1460 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to | 1463 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to |
1461 | * bit 0. However, in case of the R8A7740, R8A779x, and | 1464 | * bit 0. However, in case of the R8A7740 and R7S72100 |
1462 | * R7S72100 the RFS bits are from bit 25 to bit 16. So, the | 1465 | * the RFS bits are from bit 25 to bit 16. So, the |
1463 | * driver needs right shifting by 16. | 1466 | * driver needs right shifting by 16. |
1464 | */ | 1467 | */ |
1465 | if (mdp->cd->shift_rd0) | 1468 | if (mdp->cd->shift_rd0) |
@@ -1526,6 +1529,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1526 | skb_checksum_none_assert(skb); | 1529 | skb_checksum_none_assert(skb); |
1527 | rxdesc->addr = dma_addr; | 1530 | rxdesc->addr = dma_addr; |
1528 | } | 1531 | } |
1532 | wmb(); /* RACT bit must be set after all the above writes */ | ||
1529 | if (entry >= mdp->num_rx_ring - 1) | 1533 | if (entry >= mdp->num_rx_ring - 1) |
1530 | rxdesc->status |= | 1534 | rxdesc->status |= |
1531 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); | 1535 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); |
@@ -1538,7 +1542,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1538 | /* If we don't need to check status, don't. -KDU */ | 1542 | /* If we don't need to check status, don't. -KDU */ |
1539 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { | 1543 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { |
1540 | /* fix the values for the next receiving if RDE is set */ | 1544 | /* fix the values for the next receiving if RDE is set */ |
1541 | if (intr_status & EESR_RDE) { | 1545 | if (intr_status & EESR_RDE && mdp->reg_offset[RDFAR] != 0) { |
1542 | u32 count = (sh_eth_read(ndev, RDFAR) - | 1546 | u32 count = (sh_eth_read(ndev, RDFAR) - |
1543 | sh_eth_read(ndev, RDLAR)) >> 4; | 1547 | sh_eth_read(ndev, RDLAR)) >> 4; |
1544 | 1548 | ||
@@ -2177,7 +2181,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2177 | } | 2181 | } |
2178 | spin_unlock_irqrestore(&mdp->lock, flags); | 2182 | spin_unlock_irqrestore(&mdp->lock, flags); |
2179 | 2183 | ||
2180 | if (skb_padto(skb, ETH_ZLEN)) | 2184 | if (skb_put_padto(skb, ETH_ZLEN)) |
2181 | return NETDEV_TX_OK; | 2185 | return NETDEV_TX_OK; |
2182 | 2186 | ||
2183 | entry = mdp->cur_tx % mdp->num_tx_ring; | 2187 | entry = mdp->cur_tx % mdp->num_tx_ring; |
@@ -2195,6 +2199,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2195 | } | 2199 | } |
2196 | txdesc->buffer_length = skb->len; | 2200 | txdesc->buffer_length = skb->len; |
2197 | 2201 | ||
2202 | wmb(); /* TACT bit must be set after all the above writes */ | ||
2198 | if (entry >= mdp->num_tx_ring - 1) | 2203 | if (entry >= mdp->num_tx_ring - 1) |
2199 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); | 2204 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); |
2200 | else | 2205 | else |