diff options
| author | Grygorii Strashko <grygorii.strashko@ti.com> | 2016-04-07 08:16:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-04-11 15:11:59 -0400 |
| commit | 71a2cbb72a2bcbf3f1c1b14031870e37ad5e8109 (patch) | |
| tree | ce4dcb926cfe6e2f86bd6cf41cc1703c31bd7587 /drivers/net/ethernet | |
| parent | 61f1cef90a18122ff9832a897dc75738c14e710a (diff) | |
drivers: net: cpsw: drop host_port field from struct cpsw_priv
The host_port field is constantly assigned to 0 and this value has
never changed (since time when cpsw driver was introduced. More over,
if this field will be assigned to non 0 value it will break current
driver functionality.
Hence, there are no reasons to continue maintaining this host_port
field and it can be removed, and the HOST_PORT_NUM and ALE_PORT_HOST
defines can be used instead.
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
| -rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 5292e70b4825..54bcc3851b7e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -381,7 +381,6 @@ struct cpsw_priv { | |||
| 381 | u32 coal_intvl; | 381 | u32 coal_intvl; |
| 382 | u32 bus_freq_mhz; | 382 | u32 bus_freq_mhz; |
| 383 | int rx_packet_max; | 383 | int rx_packet_max; |
| 384 | int host_port; | ||
| 385 | struct clk *clk; | 384 | struct clk *clk; |
| 386 | u8 mac_addr[ETH_ALEN]; | 385 | u8 mac_addr[ETH_ALEN]; |
| 387 | struct cpsw_slave *slaves; | 386 | struct cpsw_slave *slaves; |
| @@ -531,7 +530,7 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = { | |||
| 531 | int slave_port = cpsw_get_slave_port(priv, \ | 530 | int slave_port = cpsw_get_slave_port(priv, \ |
| 532 | slave->slave_num); \ | 531 | slave->slave_num); \ |
| 533 | cpsw_ale_add_mcast(priv->ale, addr, \ | 532 | cpsw_ale_add_mcast(priv->ale, addr, \ |
| 534 | 1 << slave_port | 1 << priv->host_port, \ | 533 | 1 << slave_port | ALE_PORT_HOST, \ |
| 535 | ALE_VLAN, slave->port_vlan, 0); \ | 534 | ALE_VLAN, slave->port_vlan, 0); \ |
| 536 | } else { \ | 535 | } else { \ |
| 537 | cpsw_ale_add_mcast(priv->ale, addr, \ | 536 | cpsw_ale_add_mcast(priv->ale, addr, \ |
| @@ -542,10 +541,7 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = { | |||
| 542 | 541 | ||
| 543 | static inline int cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num) | 542 | static inline int cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num) |
| 544 | { | 543 | { |
| 545 | if (priv->host_port == 0) | 544 | return slave_num + 1; |
| 546 | return slave_num + 1; | ||
| 547 | else | ||
| 548 | return slave_num; | ||
| 549 | } | 545 | } |
| 550 | 546 | ||
| 551 | static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | 547 | static void cpsw_set_promiscious(struct net_device *ndev, bool enable) |
| @@ -1090,7 +1086,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries( | |||
| 1090 | struct cpsw_priv *priv, struct cpsw_slave *slave, | 1086 | struct cpsw_priv *priv, struct cpsw_slave *slave, |
| 1091 | u32 slave_port) | 1087 | u32 slave_port) |
| 1092 | { | 1088 | { |
| 1093 | u32 port_mask = 1 << slave_port | 1 << priv->host_port; | 1089 | u32 port_mask = 1 << slave_port | ALE_PORT_HOST; |
| 1094 | 1090 | ||
| 1095 | if (priv->version == CPSW_VERSION_1) | 1091 | if (priv->version == CPSW_VERSION_1) |
| 1096 | slave_write(slave, slave->port_vlan, CPSW1_PORT_VLAN); | 1092 | slave_write(slave, slave->port_vlan, CPSW1_PORT_VLAN); |
| @@ -1101,7 +1097,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries( | |||
| 1101 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1097 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
| 1102 | port_mask, ALE_VLAN, slave->port_vlan, 0); | 1098 | port_mask, ALE_VLAN, slave->port_vlan, 0); |
| 1103 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, | 1099 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, |
| 1104 | priv->host_port, ALE_VLAN | ALE_SECURE, slave->port_vlan); | 1100 | HOST_PORT_NUM, ALE_VLAN | ALE_SECURE, slave->port_vlan); |
| 1105 | } | 1101 | } |
| 1106 | 1102 | ||
| 1107 | static void soft_reset_slave(struct cpsw_slave *slave) | 1103 | static void soft_reset_slave(struct cpsw_slave *slave) |
| @@ -1202,7 +1198,7 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) | |||
| 1202 | cpsw_ale_start(priv->ale); | 1198 | cpsw_ale_start(priv->ale); |
| 1203 | 1199 | ||
| 1204 | /* switch to vlan unaware mode */ | 1200 | /* switch to vlan unaware mode */ |
| 1205 | cpsw_ale_control_set(priv->ale, priv->host_port, ALE_VLAN_AWARE, | 1201 | cpsw_ale_control_set(priv->ale, HOST_PORT_NUM, ALE_VLAN_AWARE, |
| 1206 | CPSW_ALE_VLAN_AWARE); | 1202 | CPSW_ALE_VLAN_AWARE); |
| 1207 | control_reg = readl(&priv->regs->control); | 1203 | control_reg = readl(&priv->regs->control); |
| 1208 | control_reg |= CPSW_VLAN_AWARE; | 1204 | control_reg |= CPSW_VLAN_AWARE; |
| @@ -1216,14 +1212,14 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) | |||
| 1216 | &priv->host_port_regs->cpdma_tx_pri_map); | 1212 | &priv->host_port_regs->cpdma_tx_pri_map); |
| 1217 | __raw_writel(0, &priv->host_port_regs->cpdma_rx_chan_map); | 1213 | __raw_writel(0, &priv->host_port_regs->cpdma_rx_chan_map); |
| 1218 | 1214 | ||
| 1219 | cpsw_ale_control_set(priv->ale, priv->host_port, | 1215 | cpsw_ale_control_set(priv->ale, HOST_PORT_NUM, |
| 1220 | ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); | 1216 | ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); |
| 1221 | 1217 | ||
| 1222 | if (!priv->data.dual_emac) { | 1218 | if (!priv->data.dual_emac) { |
| 1223 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, priv->host_port, | 1219 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, HOST_PORT_NUM, |
| 1224 | 0, 0); | 1220 | 0, 0); |
| 1225 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1221 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
| 1226 | 1 << priv->host_port, 0, 0, ALE_MCAST_FWD_2); | 1222 | ALE_PORT_HOST, 0, 0, ALE_MCAST_FWD_2); |
| 1227 | } | 1223 | } |
| 1228 | } | 1224 | } |
| 1229 | 1225 | ||
| @@ -1616,9 +1612,9 @@ static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) | |||
| 1616 | flags = ALE_VLAN; | 1612 | flags = ALE_VLAN; |
| 1617 | } | 1613 | } |
| 1618 | 1614 | ||
| 1619 | cpsw_ale_del_ucast(priv->ale, priv->mac_addr, priv->host_port, | 1615 | cpsw_ale_del_ucast(priv->ale, priv->mac_addr, HOST_PORT_NUM, |
| 1620 | flags, vid); | 1616 | flags, vid); |
| 1621 | cpsw_ale_add_ucast(priv->ale, addr->sa_data, priv->host_port, | 1617 | cpsw_ale_add_ucast(priv->ale, addr->sa_data, HOST_PORT_NUM, |
| 1622 | flags, vid); | 1618 | flags, vid); |
| 1623 | 1619 | ||
| 1624 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 1620 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
| @@ -1667,7 +1663,7 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
| 1667 | return ret; | 1663 | return ret; |
| 1668 | 1664 | ||
| 1669 | ret = cpsw_ale_add_ucast(priv->ale, priv->mac_addr, | 1665 | ret = cpsw_ale_add_ucast(priv->ale, priv->mac_addr, |
| 1670 | priv->host_port, ALE_VLAN, vid); | 1666 | HOST_PORT_NUM, ALE_VLAN, vid); |
| 1671 | if (ret != 0) | 1667 | if (ret != 0) |
| 1672 | goto clean_vid; | 1668 | goto clean_vid; |
| 1673 | 1669 | ||
| @@ -1679,7 +1675,7 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
| 1679 | 1675 | ||
| 1680 | clean_vlan_ucast: | 1676 | clean_vlan_ucast: |
| 1681 | cpsw_ale_del_ucast(priv->ale, priv->mac_addr, | 1677 | cpsw_ale_del_ucast(priv->ale, priv->mac_addr, |
| 1682 | priv->host_port, ALE_VLAN, vid); | 1678 | HOST_PORT_NUM, ALE_VLAN, vid); |
| 1683 | clean_vid: | 1679 | clean_vid: |
| 1684 | cpsw_ale_del_vlan(priv->ale, vid, 0); | 1680 | cpsw_ale_del_vlan(priv->ale, vid, 0); |
| 1685 | return ret; | 1681 | return ret; |
| @@ -2148,7 +2144,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev, | |||
| 2148 | priv_sl2->bus_freq_mhz = priv->bus_freq_mhz; | 2144 | priv_sl2->bus_freq_mhz = priv->bus_freq_mhz; |
| 2149 | 2145 | ||
| 2150 | priv_sl2->regs = priv->regs; | 2146 | priv_sl2->regs = priv->regs; |
| 2151 | priv_sl2->host_port = priv->host_port; | ||
| 2152 | priv_sl2->host_port_regs = priv->host_port_regs; | 2147 | priv_sl2->host_port_regs = priv->host_port_regs; |
| 2153 | priv_sl2->wr_regs = priv->wr_regs; | 2148 | priv_sl2->wr_regs = priv->wr_regs; |
| 2154 | priv_sl2->hw_stats = priv->hw_stats; | 2149 | priv_sl2->hw_stats = priv->hw_stats; |
| @@ -2317,7 +2312,6 @@ static int cpsw_probe(struct platform_device *pdev) | |||
| 2317 | goto clean_runtime_disable_ret; | 2312 | goto clean_runtime_disable_ret; |
| 2318 | } | 2313 | } |
| 2319 | priv->regs = ss_regs; | 2314 | priv->regs = ss_regs; |
| 2320 | priv->host_port = HOST_PORT_NUM; | ||
| 2321 | 2315 | ||
| 2322 | /* Need to enable clocks with runtime PM api to access module | 2316 | /* Need to enable clocks with runtime PM api to access module |
| 2323 | * registers | 2317 | * registers |
