@@ -1358,6 +1358,47 @@ static enum ethernet_hw_caps eth_stm32_hal_get_capabilities(const struct device
1358
1358
;
1359
1359
}
1360
1360
1361
+ static int eth_stm32_hal_get_config (const struct device * dev , enum ethernet_config_type type ,
1362
+ struct ethernet_config * config )
1363
+ {
1364
+ int ret = - ENOTSUP ;
1365
+ struct eth_stm32_hal_dev_data * dev_data ;
1366
+ ETH_HandleTypeDef * heth ;
1367
+
1368
+ dev_data = dev -> data ;
1369
+ heth = & dev_data -> heth ;
1370
+
1371
+ switch (type ) {
1372
+ case ETHERNET_CONFIG_TYPE_MAC_ADDRESS :
1373
+ memcpy (config -> mac_address .addr , dev_data -> mac_addr ,
1374
+ sizeof (config -> mac_address .addr ));
1375
+ ret = 0 ;
1376
+ break ;
1377
+ case ETHERNET_CONFIG_TYPE_PROMISC_MODE :
1378
+ #if defined(CONFIG_NET_PROMISCUOUS_MODE )
1379
+ #if DT_HAS_COMPAT_STATUS_OKAY (st_stm32h7_ethernet )
1380
+ if (heth -> Instance -> MACPFR & ETH_MACPFR_PR ) {
1381
+ config -> promisc_mode = true;
1382
+ } else {
1383
+ config -> promisc_mode = false;
1384
+ }
1385
+ #else
1386
+ if (heth -> Instance -> MACFFR & ETH_MACFFR_PM ) {
1387
+ config -> promisc_mode = true;
1388
+ } else {
1389
+ config -> promisc_mode = false;
1390
+ }
1391
+ #endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */
1392
+ ret = 0 ;
1393
+ #endif /* CONFIG_NET_PROMISCUOUS_MODE */
1394
+ break ;
1395
+ default :
1396
+ break ;
1397
+ }
1398
+
1399
+ return ret ;
1400
+ }
1401
+
1361
1402
static int eth_stm32_hal_set_config (const struct device * dev ,
1362
1403
enum ethernet_config_type type ,
1363
1404
const struct ethernet_config * config )
@@ -1449,6 +1490,7 @@ static const struct ethernet_api eth_api = {
1449
1490
#if DT_HAS_COMPAT_STATUS_OKAY (st_stm32_mdio )
1450
1491
.get_phy = eth_stm32_hal_get_phy ,
1451
1492
#endif
1493
+ .get_config = eth_stm32_hal_get_config ,
1452
1494
#if defined(CONFIG_NET_DSA )
1453
1495
.send = dsa_tx ,
1454
1496
#else
0 commit comments