@@ -381,7 +381,6 @@ struct cpsw_priv {
381
381
u32 coal_intvl ;
382
382
u32 bus_freq_mhz ;
383
383
int rx_packet_max ;
384
- int host_port ;
385
384
struct clk * clk ;
386
385
u8 mac_addr [ETH_ALEN ];
387
386
struct cpsw_slave * slaves ;
@@ -531,21 +530,18 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = {
531
530
int slave_port = cpsw_get_slave_port(priv, \
532
531
slave->slave_num); \
533
532
cpsw_ale_add_mcast(priv->ale, addr, \
534
- 1 << slave_port | 1 << priv->host_port , \
533
+ 1 << slave_port | ALE_PORT_HOST , \
535
534
ALE_VLAN, slave->port_vlan, 0); \
536
535
} else { \
537
536
cpsw_ale_add_mcast(priv->ale, addr, \
538
- ALE_ALL_PORTS << priv->host_port, \
537
+ ALE_ALL_PORTS, \
539
538
0, 0, 0); \
540
539
} \
541
540
} while (0)
542
541
543
542
static inline int cpsw_get_slave_port (struct cpsw_priv * priv , u32 slave_num )
544
543
{
545
- if (priv -> host_port == 0 )
546
- return slave_num + 1 ;
547
- else
548
- return slave_num ;
544
+ return slave_num + 1 ;
549
545
}
550
546
551
547
static void cpsw_set_promiscious (struct net_device * ndev , bool enable )
@@ -602,8 +598,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
602
598
cpsw_ale_control_set (ale , 0 , ALE_AGEOUT , 1 );
603
599
604
600
/* Clear all mcast from ALE */
605
- cpsw_ale_flush_multicast (ale , ALE_ALL_PORTS <<
606
- priv -> host_port , -1 );
601
+ cpsw_ale_flush_multicast (ale , ALE_ALL_PORTS , -1 );
607
602
608
603
/* Flood All Unicast Packets to Host port */
609
604
cpsw_ale_control_set (ale , 0 , ALE_P0_UNI_FLOOD , 1 );
@@ -648,8 +643,7 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
648
643
cpsw_ale_set_allmulti (priv -> ale , priv -> ndev -> flags & IFF_ALLMULTI );
649
644
650
645
/* Clear all mcast from ALE */
651
- cpsw_ale_flush_multicast (priv -> ale , ALE_ALL_PORTS << priv -> host_port ,
652
- vid );
646
+ cpsw_ale_flush_multicast (priv -> ale , ALE_ALL_PORTS , vid );
653
647
654
648
if (!netdev_mc_empty (ndev )) {
655
649
struct netdev_hw_addr * ha ;
@@ -1092,7 +1086,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
1092
1086
struct cpsw_priv * priv , struct cpsw_slave * slave ,
1093
1087
u32 slave_port )
1094
1088
{
1095
- u32 port_mask = 1 << slave_port | 1 << priv -> host_port ;
1089
+ u32 port_mask = 1 << slave_port | ALE_PORT_HOST ;
1096
1090
1097
1091
if (priv -> version == CPSW_VERSION_1 )
1098
1092
slave_write (slave , slave -> port_vlan , CPSW1_PORT_VLAN );
@@ -1103,7 +1097,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
1103
1097
cpsw_ale_add_mcast (priv -> ale , priv -> ndev -> broadcast ,
1104
1098
port_mask , ALE_VLAN , slave -> port_vlan , 0 );
1105
1099
cpsw_ale_add_ucast (priv -> ale , priv -> mac_addr ,
1106
- priv -> host_port , ALE_VLAN | ALE_SECURE , slave -> port_vlan );
1100
+ HOST_PORT_NUM , ALE_VLAN | ALE_SECURE , slave -> port_vlan );
1107
1101
}
1108
1102
1109
1103
static void soft_reset_slave (struct cpsw_slave * slave )
@@ -1172,7 +1166,6 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
1172
1166
static inline void cpsw_add_default_vlan (struct cpsw_priv * priv )
1173
1167
{
1174
1168
const int vlan = priv -> data .default_vlan ;
1175
- const int port = priv -> host_port ;
1176
1169
u32 reg ;
1177
1170
int i ;
1178
1171
int unreg_mcast_mask ;
@@ -1190,9 +1183,9 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
1190
1183
else
1191
1184
unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2 ;
1192
1185
1193
- cpsw_ale_add_vlan (priv -> ale , vlan , ALE_ALL_PORTS << port ,
1194
- ALE_ALL_PORTS << port , ALE_ALL_PORTS << port ,
1195
- unreg_mcast_mask << port );
1186
+ cpsw_ale_add_vlan (priv -> ale , vlan , ALE_ALL_PORTS ,
1187
+ ALE_ALL_PORTS , ALE_ALL_PORTS ,
1188
+ unreg_mcast_mask );
1196
1189
}
1197
1190
1198
1191
static void cpsw_init_host_port (struct cpsw_priv * priv )
@@ -1205,7 +1198,7 @@ static void cpsw_init_host_port(struct cpsw_priv *priv)
1205
1198
cpsw_ale_start (priv -> ale );
1206
1199
1207
1200
/* switch to vlan unaware mode */
1208
- 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 ,
1209
1202
CPSW_ALE_VLAN_AWARE );
1210
1203
control_reg = readl (& priv -> regs -> control );
1211
1204
control_reg |= CPSW_VLAN_AWARE ;
@@ -1219,14 +1212,14 @@ static void cpsw_init_host_port(struct cpsw_priv *priv)
1219
1212
& priv -> host_port_regs -> cpdma_tx_pri_map );
1220
1213
__raw_writel (0 , & priv -> host_port_regs -> cpdma_rx_chan_map );
1221
1214
1222
- cpsw_ale_control_set (priv -> ale , priv -> host_port ,
1215
+ cpsw_ale_control_set (priv -> ale , HOST_PORT_NUM ,
1223
1216
ALE_PORT_STATE , ALE_PORT_STATE_FORWARD );
1224
1217
1225
1218
if (!priv -> data .dual_emac ) {
1226
- 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 ,
1227
1220
0 , 0 );
1228
1221
cpsw_ale_add_mcast (priv -> ale , priv -> ndev -> broadcast ,
1229
- 1 << priv -> host_port , 0 , 0 , ALE_MCAST_FWD_2 );
1222
+ ALE_PORT_HOST , 0 , 0 , ALE_MCAST_FWD_2 );
1230
1223
}
1231
1224
}
1232
1225
@@ -1273,8 +1266,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
1273
1266
cpsw_add_default_vlan (priv );
1274
1267
else
1275
1268
cpsw_ale_add_vlan (priv -> ale , priv -> data .default_vlan ,
1276
- ALE_ALL_PORTS << priv -> host_port ,
1277
- ALE_ALL_PORTS << priv -> host_port , 0 , 0 );
1269
+ ALE_ALL_PORTS , ALE_ALL_PORTS , 0 , 0 );
1278
1270
1279
1271
if (!cpsw_common_res_usage_state (priv )) {
1280
1272
struct cpsw_priv * priv_sl0 = cpsw_get_slave_priv (priv , 0 );
@@ -1620,9 +1612,9 @@ static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
1620
1612
flags = ALE_VLAN ;
1621
1613
}
1622
1614
1623
- 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 ,
1624
1616
flags , vid );
1625
- 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 ,
1626
1618
flags , vid );
1627
1619
1628
1620
memcpy (priv -> mac_addr , addr -> sa_data , ETH_ALEN );
@@ -1666,12 +1658,12 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv,
1666
1658
}
1667
1659
1668
1660
ret = cpsw_ale_add_vlan (priv -> ale , vid , port_mask , 0 , port_mask ,
1669
- unreg_mcast_mask << priv -> host_port );
1661
+ unreg_mcast_mask );
1670
1662
if (ret != 0 )
1671
1663
return ret ;
1672
1664
1673
1665
ret = cpsw_ale_add_ucast (priv -> ale , priv -> mac_addr ,
1674
- priv -> host_port , ALE_VLAN , vid );
1666
+ HOST_PORT_NUM , ALE_VLAN , vid );
1675
1667
if (ret != 0 )
1676
1668
goto clean_vid ;
1677
1669
@@ -1683,7 +1675,7 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv,
1683
1675
1684
1676
clean_vlan_ucast :
1685
1677
cpsw_ale_del_ucast (priv -> ale , priv -> mac_addr ,
1686
- priv -> host_port , ALE_VLAN , vid );
1678
+ HOST_PORT_NUM , ALE_VLAN , vid );
1687
1679
clean_vid :
1688
1680
cpsw_ale_del_vlan (priv -> ale , vid , 0 );
1689
1681
return ret ;
@@ -1738,7 +1730,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
1738
1730
return ret ;
1739
1731
1740
1732
ret = cpsw_ale_del_ucast (priv -> ale , priv -> mac_addr ,
1741
- priv -> host_port , ALE_VLAN , vid );
1733
+ HOST_PORT_NUM , ALE_VLAN , vid );
1742
1734
if (ret != 0 )
1743
1735
return ret ;
1744
1736
@@ -2152,7 +2144,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
2152
2144
priv_sl2 -> bus_freq_mhz = priv -> bus_freq_mhz ;
2153
2145
2154
2146
priv_sl2 -> regs = priv -> regs ;
2155
- priv_sl2 -> host_port = priv -> host_port ;
2156
2147
priv_sl2 -> host_port_regs = priv -> host_port_regs ;
2157
2148
priv_sl2 -> wr_regs = priv -> wr_regs ;
2158
2149
priv_sl2 -> hw_stats = priv -> hw_stats ;
@@ -2321,7 +2312,6 @@ static int cpsw_probe(struct platform_device *pdev)
2321
2312
goto clean_runtime_disable_ret ;
2322
2313
}
2323
2314
priv -> regs = ss_regs ;
2324
- priv -> host_port = HOST_PORT_NUM ;
2325
2315
2326
2316
/* Need to enable clocks with runtime PM api to access module
2327
2317
* registers
0 commit comments