aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/platforms/STM32/mac_lld.c4
-rw-r--r--os/hal/platforms/STM32/mac_lld.h7
2 files changed, 11 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32/mac_lld.c b/os/hal/platforms/STM32/mac_lld.c
index 2a91009c5..eb87d579d 100644
--- a/os/hal/platforms/STM32/mac_lld.c
+++ b/os/hal/platforms/STM32/mac_lld.c
@@ -306,8 +306,10 @@ void mac_lld_start(MACDriver *macp) {
/* ISR vector enabled.*/
nvicEnableVector(ETH_IRQn, CORTEX_PRIORITY_MASK(STM32_ETH1_IRQ_PRIORITY));
+#if STM32_ETH1_CHANGE_PHY_STATE
/* PHY in power up mode.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) & ~BMCR_PDOWN);
+#endif
/* MAC configuration.*/
ETH->MACFFR = 0;
@@ -361,8 +363,10 @@ void mac_lld_start(MACDriver *macp) {
void mac_lld_stop(MACDriver *macp) {
if (macp->state != MAC_STOP) {
+#if STM32_ETH1_CHANGE_PHY_STATE
/* PHY in power down mode until the driver will be restarted.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) | BMCR_PDOWN);
+#endif
/* MAC and DMA stopped.*/
ETH->MACCR = 0;
diff --git a/os/hal/platforms/STM32/mac_lld.h b/os/hal/platforms/STM32/mac_lld.h
index 32ef3ba79..9709bcdb7 100644
--- a/os/hal/platforms/STM32/mac_lld.h
+++ b/os/hal/platforms/STM32/mac_lld.h
@@ -155,6 +155,13 @@
#endif
/**
+ * @brief Change the PHY power state inside the driver.
+ */
+#if !defined(STM32_ETH1_CHANGE_PHY_STATE) || defined(__DOXYGEN__)
+#define STM32_ETH1_CHANGE_PHY_STATE TRUE
+#endif
+
+/**
* @brief ETHD1 interrupt priority level setting.
*/
#if !defined(STM32_ETH1_IRQ_PRIORITY) || defined(__DOXYGEN__)