@@ -31,6 +31,20 @@ static void _intr2_mask_set(struct bcmasp_priv *priv, u32 mask)
31
31
priv -> irq_mask |= mask ;
32
32
}
33
33
34
+ void bcmasp_enable_phy_irq (struct bcmasp_intf * intf , int en )
35
+ {
36
+ struct bcmasp_priv * priv = intf -> parent ;
37
+
38
+ /* Only supported with internal phys */
39
+ if (!intf -> internal_phy )
40
+ return ;
41
+
42
+ if (en )
43
+ _intr2_mask_clear (priv , ASP_INTR2_PHY_EVENT (intf -> channel ));
44
+ else
45
+ _intr2_mask_set (priv , ASP_INTR2_PHY_EVENT (intf -> channel ));
46
+ }
47
+
34
48
void bcmasp_enable_tx_irq (struct bcmasp_intf * intf , int en )
35
49
{
36
50
struct bcmasp_priv * priv = intf -> parent ;
@@ -79,6 +93,9 @@ static void bcmasp_intr2_handling(struct bcmasp_intf *intf, u32 status)
79
93
__napi_schedule_irqoff (& intf -> tx_napi );
80
94
}
81
95
}
96
+
97
+ if (status & ASP_INTR2_PHY_EVENT (intf -> channel ))
98
+ phy_mac_interrupt (intf -> ndev -> phydev );
82
99
}
83
100
84
101
static irqreturn_t bcmasp_isr (int irq , void * data )
@@ -972,7 +989,26 @@ static void bcmasp_core_init(struct bcmasp_priv *priv)
972
989
ASP_INTR2_CLEAR );
973
990
}
974
991
975
- static void bcmasp_core_clock_select (struct bcmasp_priv * priv , bool slow )
992
+ static void bcmasp_core_clock_select_many (struct bcmasp_priv * priv , bool slow )
993
+ {
994
+ u32 reg ;
995
+
996
+ reg = ctrl2_core_rl (priv , ASP_CTRL2_CORE_CLOCK_SELECT );
997
+ if (slow )
998
+ reg &= ~ASP_CTRL2_CORE_CLOCK_SELECT_MAIN ;
999
+ else
1000
+ reg |= ASP_CTRL2_CORE_CLOCK_SELECT_MAIN ;
1001
+ ctrl2_core_wl (priv , reg , ASP_CTRL2_CORE_CLOCK_SELECT );
1002
+
1003
+ reg = ctrl2_core_rl (priv , ASP_CTRL2_CPU_CLOCK_SELECT );
1004
+ if (slow )
1005
+ reg &= ~ASP_CTRL2_CPU_CLOCK_SELECT_MAIN ;
1006
+ else
1007
+ reg |= ASP_CTRL2_CPU_CLOCK_SELECT_MAIN ;
1008
+ ctrl2_core_wl (priv , reg , ASP_CTRL2_CPU_CLOCK_SELECT );
1009
+ }
1010
+
1011
+ static void bcmasp_core_clock_select_one (struct bcmasp_priv * priv , bool slow )
976
1012
{
977
1013
u32 reg ;
978
1014
@@ -1166,6 +1202,24 @@ static void bcmasp_wol_irq_destroy_per_intf(struct bcmasp_priv *priv)
1166
1202
}
1167
1203
}
1168
1204
1205
+ static void bcmasp_eee_fixup (struct bcmasp_intf * intf , bool en )
1206
+ {
1207
+ u32 reg , phy_lpi_overwrite ;
1208
+
1209
+ reg = rx_edpkt_core_rl (intf -> parent , ASP_EDPKT_SPARE_REG );
1210
+ phy_lpi_overwrite = intf -> internal_phy ? ASP_EDPKT_SPARE_REG_EPHY_LPI :
1211
+ ASP_EDPKT_SPARE_REG_GPHY_LPI ;
1212
+
1213
+ if (en )
1214
+ reg |= phy_lpi_overwrite ;
1215
+ else
1216
+ reg &= ~phy_lpi_overwrite ;
1217
+
1218
+ rx_edpkt_core_wl (intf -> parent , reg , ASP_EDPKT_SPARE_REG );
1219
+
1220
+ usleep_range (50 , 100 );
1221
+ }
1222
+
1169
1223
static struct bcmasp_hw_info v20_hw_info = {
1170
1224
.rx_ctrl_flush = ASP_RX_CTRL_FLUSH ,
1171
1225
.umac2fb = UMAC2FB_OFFSET ,
@@ -1178,6 +1232,7 @@ static const struct bcmasp_plat_data v20_plat_data = {
1178
1232
.init_wol = bcmasp_init_wol_per_intf ,
1179
1233
.enable_wol = bcmasp_enable_wol_per_intf ,
1180
1234
.destroy_wol = bcmasp_wol_irq_destroy_per_intf ,
1235
+ .core_clock_select = bcmasp_core_clock_select_one ,
1181
1236
.hw_info = & v20_hw_info ,
1182
1237
};
1183
1238
@@ -1194,17 +1249,39 @@ static const struct bcmasp_plat_data v21_plat_data = {
1194
1249
.init_wol = bcmasp_init_wol_shared ,
1195
1250
.enable_wol = bcmasp_enable_wol_shared ,
1196
1251
.destroy_wol = bcmasp_wol_irq_destroy_shared ,
1252
+ .core_clock_select = bcmasp_core_clock_select_one ,
1253
+ .hw_info = & v21_hw_info ,
1254
+ };
1255
+
1256
+ static const struct bcmasp_plat_data v22_plat_data = {
1257
+ .init_wol = bcmasp_init_wol_shared ,
1258
+ .enable_wol = bcmasp_enable_wol_shared ,
1259
+ .destroy_wol = bcmasp_wol_irq_destroy_shared ,
1260
+ .core_clock_select = bcmasp_core_clock_select_many ,
1197
1261
.hw_info = & v21_hw_info ,
1262
+ .eee_fixup = bcmasp_eee_fixup ,
1198
1263
};
1199
1264
1265
+ static void bcmasp_set_pdata (struct bcmasp_priv * priv , const struct bcmasp_plat_data * pdata )
1266
+ {
1267
+ priv -> init_wol = pdata -> init_wol ;
1268
+ priv -> enable_wol = pdata -> enable_wol ;
1269
+ priv -> destroy_wol = pdata -> destroy_wol ;
1270
+ priv -> core_clock_select = pdata -> core_clock_select ;
1271
+ priv -> eee_fixup = pdata -> eee_fixup ;
1272
+ priv -> hw_info = pdata -> hw_info ;
1273
+ }
1274
+
1200
1275
static const struct of_device_id bcmasp_of_match [] = {
1201
1276
{ .compatible = "brcm,asp-v2.0" , .data = & v20_plat_data },
1202
1277
{ .compatible = "brcm,asp-v2.1" , .data = & v21_plat_data },
1278
+ { .compatible = "brcm,asp-v2.2" , .data = & v22_plat_data },
1203
1279
{ /* sentinel */ },
1204
1280
};
1205
1281
MODULE_DEVICE_TABLE (of , bcmasp_of_match );
1206
1282
1207
1283
static const struct of_device_id bcmasp_mdio_of_match [] = {
1284
+ { .compatible = "brcm,asp-v2.2-mdio" , },
1208
1285
{ .compatible = "brcm,asp-v2.1-mdio" , },
1209
1286
{ .compatible = "brcm,asp-v2.0-mdio" , },
1210
1287
{ /* sentinel */ },
@@ -1265,16 +1342,13 @@ static int bcmasp_probe(struct platform_device *pdev)
1265
1342
if (!pdata )
1266
1343
return dev_err_probe (dev , - EINVAL , "unable to find platform data\n" );
1267
1344
1268
- priv -> init_wol = pdata -> init_wol ;
1269
- priv -> enable_wol = pdata -> enable_wol ;
1270
- priv -> destroy_wol = pdata -> destroy_wol ;
1271
- priv -> hw_info = pdata -> hw_info ;
1345
+ bcmasp_set_pdata (priv , pdata );
1272
1346
1273
1347
/* Enable all clocks to ensure successful probing */
1274
1348
bcmasp_core_clock_set (priv , ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE , 0 );
1275
1349
1276
1350
/* Switch to the main clock */
1277
- bcmasp_core_clock_select (priv , false);
1351
+ priv -> core_clock_select (priv , false);
1278
1352
1279
1353
bcmasp_intr2_mask_set_all (priv );
1280
1354
bcmasp_intr2_clear_all (priv );
@@ -1381,7 +1455,7 @@ static int __maybe_unused bcmasp_suspend(struct device *d)
1381
1455
*/
1382
1456
bcmasp_core_clock_set (priv , 0 , ASP_CTRL_CLOCK_CTRL_ASP_TX_DISABLE );
1383
1457
1384
- bcmasp_core_clock_select (priv , true);
1458
+ priv -> core_clock_select (priv , true);
1385
1459
1386
1460
clk_disable_unprepare (priv -> clk );
1387
1461
@@ -1399,7 +1473,7 @@ static int __maybe_unused bcmasp_resume(struct device *d)
1399
1473
return ret ;
1400
1474
1401
1475
/* Switch to the main clock domain */
1402
- bcmasp_core_clock_select (priv , false);
1476
+ priv -> core_clock_select (priv , false);
1403
1477
1404
1478
/* Re-enable all clocks for re-initialization */
1405
1479
bcmasp_core_clock_set (priv , ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE , 0 );
0 commit comments