From bc0373893f147f1f6e3155f04965ca06b9cbff18 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 29 Sep 2012 08:26:05 +0000 Subject: [PATCH] Fixed bug 3570335. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4724 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/mac_lld.c | 4 ++++ os/hal/platforms/STM32/mac_lld.h | 7 +++++++ readme.txt | 4 ++++ 3 files changed, 15 insertions(+) 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 @@ -154,6 +154,13 @@ #define STM32_MAC_PHY_TIMEOUT 100 #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. */ diff --git a/readme.txt b/readme.txt index 51ebeb21b..f91c20890 100644 --- a/readme.txt +++ b/readme.txt @@ -83,6 +83,8 @@ ***************************************************************************** *** 2.5.1 *** +- FIX: Fixed Ethernet PHY power down scheme prevents using LAN8720A (bug + 3570335). - FIX: Fixed FatFS won't compile with _FS_REENTRANT enabled (bug 3570135) (backported to 2.4.3). - FIX: Fixed mmc_spi.c won't compile due to misplaced declaration (bug @@ -97,6 +99,8 @@ (backported to 2.4.3). - FIX: Fixed STM8L, cosmic compiler: c_lreg not saved (bug 3566342)(backported to 2.2.10 and 2.4.3). +- NEW: Added a new option STM32_ETH1_CHANGE_PHY_STATE to the STM32 MAC driver, + this change is connected to bug 3570335. - NEW: Modified the CAN drivers to use the new event flags mechanism, the previous flags handling has been removed. - NEW: Modified serial and serial_usb drivers to use the new event flags