@@ -972,7 +972,26 @@ static void bcmasp_core_init(struct bcmasp_priv *priv)
972972 ASP_INTR2_CLEAR );
973973}
974974
975- static void bcmasp_core_clock_select (struct bcmasp_priv * priv , bool slow )
975+ static void bcmasp_core_clock_select_many (struct bcmasp_priv * priv , bool slow )
976+ {
977+ u32 reg ;
978+
979+ reg = ctrl2_core_rl (priv , ASP_CTRL2_CORE_CLOCK_SELECT );
980+ if (slow )
981+ reg &= ~ASP_CTRL2_CORE_CLOCK_SELECT_MAIN ;
982+ else
983+ reg |= ASP_CTRL2_CORE_CLOCK_SELECT_MAIN ;
984+ ctrl2_core_wl (priv , reg , ASP_CTRL2_CORE_CLOCK_SELECT );
985+
986+ reg = ctrl2_core_rl (priv , ASP_CTRL2_CPU_CLOCK_SELECT );
987+ if (slow )
988+ reg &= ~ASP_CTRL2_CPU_CLOCK_SELECT_MAIN ;
989+ else
990+ reg |= ASP_CTRL2_CPU_CLOCK_SELECT_MAIN ;
991+ ctrl2_core_wl (priv , reg , ASP_CTRL2_CPU_CLOCK_SELECT );
992+ }
993+
994+ static void bcmasp_core_clock_select_one (struct bcmasp_priv * priv , bool slow )
976995{
977996 u32 reg ;
978997
@@ -1166,6 +1185,24 @@ static void bcmasp_wol_irq_destroy_per_intf(struct bcmasp_priv *priv)
11661185 }
11671186}
11681187
1188+ static void bcmasp_eee_fixup (struct bcmasp_intf * intf , bool en )
1189+ {
1190+ u32 reg , phy_lpi_overwrite ;
1191+
1192+ reg = rx_edpkt_core_rl (intf -> parent , ASP_EDPKT_SPARE_REG );
1193+ phy_lpi_overwrite = intf -> internal_phy ? ASP_EDPKT_SPARE_REG_EPHY_LPI :
1194+ ASP_EDPKT_SPARE_REG_GPHY_LPI ;
1195+
1196+ if (en )
1197+ reg |= phy_lpi_overwrite ;
1198+ else
1199+ reg &= ~phy_lpi_overwrite ;
1200+
1201+ rx_edpkt_core_wl (intf -> parent , reg , ASP_EDPKT_SPARE_REG );
1202+
1203+ usleep_range (50 , 100 );
1204+ }
1205+
11691206static struct bcmasp_hw_info v20_hw_info = {
11701207 .rx_ctrl_flush = ASP_RX_CTRL_FLUSH ,
11711208 .umac2fb = UMAC2FB_OFFSET ,
@@ -1178,6 +1215,7 @@ static const struct bcmasp_plat_data v20_plat_data = {
11781215 .init_wol = bcmasp_init_wol_per_intf ,
11791216 .enable_wol = bcmasp_enable_wol_per_intf ,
11801217 .destroy_wol = bcmasp_wol_irq_destroy_per_intf ,
1218+ .core_clock_select = bcmasp_core_clock_select_one ,
11811219 .hw_info = & v20_hw_info ,
11821220};
11831221
@@ -1194,17 +1232,39 @@ static const struct bcmasp_plat_data v21_plat_data = {
11941232 .init_wol = bcmasp_init_wol_shared ,
11951233 .enable_wol = bcmasp_enable_wol_shared ,
11961234 .destroy_wol = bcmasp_wol_irq_destroy_shared ,
1235+ .core_clock_select = bcmasp_core_clock_select_one ,
11971236 .hw_info = & v21_hw_info ,
11981237};
11991238
1239+ static const struct bcmasp_plat_data v22_plat_data = {
1240+ .init_wol = bcmasp_init_wol_shared ,
1241+ .enable_wol = bcmasp_enable_wol_shared ,
1242+ .destroy_wol = bcmasp_wol_irq_destroy_shared ,
1243+ .core_clock_select = bcmasp_core_clock_select_many ,
1244+ .hw_info = & v21_hw_info ,
1245+ .eee_fixup = bcmasp_eee_fixup ,
1246+ };
1247+
1248+ static void bcmasp_set_pdata (struct bcmasp_priv * priv , const struct bcmasp_plat_data * pdata )
1249+ {
1250+ priv -> init_wol = pdata -> init_wol ;
1251+ priv -> enable_wol = pdata -> enable_wol ;
1252+ priv -> destroy_wol = pdata -> destroy_wol ;
1253+ priv -> core_clock_select = pdata -> core_clock_select ;
1254+ priv -> eee_fixup = pdata -> eee_fixup ;
1255+ priv -> hw_info = pdata -> hw_info ;
1256+ }
1257+
12001258static const struct of_device_id bcmasp_of_match [] = {
12011259 { .compatible = "brcm,asp-v2.0" , .data = & v20_plat_data },
12021260 { .compatible = "brcm,asp-v2.1" , .data = & v21_plat_data },
1261+ { .compatible = "brcm,asp-v2.2" , .data = & v22_plat_data },
12031262 { /* sentinel */ },
12041263};
12051264MODULE_DEVICE_TABLE (of , bcmasp_of_match );
12061265
12071266static const struct of_device_id bcmasp_mdio_of_match [] = {
1267+ { .compatible = "brcm,asp-v2.2-mdio" , },
12081268 { .compatible = "brcm,asp-v2.1-mdio" , },
12091269 { .compatible = "brcm,asp-v2.0-mdio" , },
12101270 { /* sentinel */ },
@@ -1265,16 +1325,13 @@ static int bcmasp_probe(struct platform_device *pdev)
12651325 if (!pdata )
12661326 return dev_err_probe (dev , - EINVAL , "unable to find platform data\n" );
12671327
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 ;
1328+ bcmasp_set_pdata (priv , pdata );
12721329
12731330 /* Enable all clocks to ensure successful probing */
12741331 bcmasp_core_clock_set (priv , ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE , 0 );
12751332
12761333 /* Switch to the main clock */
1277- bcmasp_core_clock_select (priv , false);
1334+ priv -> core_clock_select (priv , false);
12781335
12791336 bcmasp_intr2_mask_set_all (priv );
12801337 bcmasp_intr2_clear_all (priv );
@@ -1381,7 +1438,7 @@ static int __maybe_unused bcmasp_suspend(struct device *d)
13811438 */
13821439 bcmasp_core_clock_set (priv , 0 , ASP_CTRL_CLOCK_CTRL_ASP_TX_DISABLE );
13831440
1384- bcmasp_core_clock_select (priv , true);
1441+ priv -> core_clock_select (priv , true);
13851442
13861443 clk_disable_unprepare (priv -> clk );
13871444
@@ -1399,7 +1456,7 @@ static int __maybe_unused bcmasp_resume(struct device *d)
13991456 return ret ;
14001457
14011458 /* Switch to the main clock domain */
1402- bcmasp_core_clock_select (priv , false);
1459+ priv -> core_clock_select (priv , false);
14031460
14041461 /* Re-enable all clocks for re-initialization */
14051462 bcmasp_core_clock_set (priv , ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE , 0 );
0 commit comments