aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-04-01 14:09:54 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-01 14:09:54 -0400
commit5366271c72689059203007143487c69dd498206c (patch)
tree067f91f3dcb5cb4c664304af76c201183cf88df8
parent16c3c91346961fdd733ad232311772795599be7f (diff)
parente14549a50a6c5e3320bb941440b1c3ae4812ea69 (diff)
Merge branch 'sh_eth-remove-SH_ETH_OFFSET_INVALID-abuses'
Sergei Shtylyov says: ==================== sh_eth: remove SH_ETH_OFFSET_INVALID abuses Here's a set of 2 patches against DaveM's 'net-next.git' repo. They get rid of the abuse of SH_ETH_OFFSET_INVALID for the register existence checks, so that only its necessary uses would remain... ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c30
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h1
2 files changed, 14 insertions, 17 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 306558ef36b5..b6b90a6314e3 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -702,6 +702,7 @@ static struct sh_eth_cpu_data rcar_gen1_data = {
702 .mpr = 1, 702 .mpr = 1,
703 .tpauser = 1, 703 .tpauser = 1,
704 .hw_swap = 1, 704 .hw_swap = 1,
705 .no_xdfar = 1,
705}; 706};
706 707
707/* R-Car Gen2 and RZ/G1 */ 708/* R-Car Gen2 and RZ/G1 */
@@ -735,6 +736,7 @@ static struct sh_eth_cpu_data rcar_gen2_data = {
735 .mpr = 1, 736 .mpr = 1,
736 .tpauser = 1, 737 .tpauser = 1,
737 .hw_swap = 1, 738 .hw_swap = 1,
739 .no_xdfar = 1,
738 .rmiimode = 1, 740 .rmiimode = 1,
739 .magic = 1, 741 .magic = 1,
740}; 742};
@@ -1615,8 +1617,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1615 /* If we don't need to check status, don't. -KDU */ 1617 /* If we don't need to check status, don't. -KDU */
1616 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { 1618 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
1617 /* fix the values for the next receiving if RDE is set */ 1619 /* fix the values for the next receiving if RDE is set */
1618 if (intr_status & EESR_RDE && 1620 if (intr_status & EESR_RDE && !mdp->cd->no_xdfar) {
1619 mdp->reg_offset[RDFAR] != SH_ETH_OFFSET_INVALID) {
1620 u32 count = (sh_eth_read(ndev, RDFAR) - 1621 u32 count = (sh_eth_read(ndev, RDFAR) -
1621 sh_eth_read(ndev, RDLAR)) >> 4; 1622 sh_eth_read(ndev, RDLAR)) >> 4;
1622 1623
@@ -2152,22 +2153,17 @@ static size_t __sh_eth_get_regs(struct net_device *ndev, u32 *buf)
2152 add_tsu_reg(TSU_POST2); 2153 add_tsu_reg(TSU_POST2);
2153 add_tsu_reg(TSU_POST3); 2154 add_tsu_reg(TSU_POST3);
2154 add_tsu_reg(TSU_POST4); 2155 add_tsu_reg(TSU_POST4);
2155 if (mdp->reg_offset[TSU_ADRH0] != SH_ETH_OFFSET_INVALID) { 2156 /* This is the start of a table, not just a single register. */
2156 /* This is the start of a table, not just a single 2157 if (buf) {
2157 * register. 2158 unsigned int i;
2158 */ 2159
2159 if (buf) { 2160 mark_reg_valid(TSU_ADRH0);
2160 unsigned int i; 2161 for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES * 2; i++)
2161 2162 *buf++ = ioread32(mdp->tsu_addr +
2162 mark_reg_valid(TSU_ADRH0); 2163 mdp->reg_offset[TSU_ADRH0] +
2163 for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES * 2; i++) 2164 i * 4);
2164 *buf++ = ioread32(
2165 mdp->tsu_addr +
2166 mdp->reg_offset[TSU_ADRH0] +
2167 i * 4);
2168 }
2169 len += SH_ETH_TSU_CAM_ENTRIES * 2;
2170 } 2165 }
2166 len += SH_ETH_TSU_CAM_ENTRIES * 2;
2171 } 2167 }
2172 2168
2173#undef mark_reg_valid 2169#undef mark_reg_valid
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index a0416e04306a..a5b792ce2ae7 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -508,6 +508,7 @@ struct sh_eth_cpu_data {
508 unsigned rpadir:1; /* E-DMAC have RPADIR */ 508 unsigned rpadir:1; /* E-DMAC have RPADIR */
509 unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ 509 unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */
510 unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ 510 unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */
511 unsigned no_xdfar:1; /* E-DMAC DOES NOT have RDFAR/TDFAR */
511 unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */ 512 unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */
512 unsigned hw_checksum:1; /* E-DMAC has CSMR */ 513 unsigned hw_checksum:1; /* E-DMAC has CSMR */
513 unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */ 514 unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */