[BUG] STM32 HAL ETH driver sets wrong MDIO frequency
The code in HAL_ETH_SetMDIOClockRange() function for H7 series, starting from HCLK frequency of 150 MHz and higher, sets the MDIO clock divider to 102. Per IEEE 802.3 specification the MDIO clock must not exceed 2,5 MHz, which means that it will be valid for HCLK up to 2,5 MHz * 102 = 255 MHz. But for H72x/H73x parts the maximum AHB frequency is 275 MHz and for H7Ax/H7Bx parts 280 MHz. Obviously the solution is to add a range with a divider 124, which will be valid up to 2,5 MHz * 124 = 310 MHz. The code for H5 series is correct, although ironically the maximum HCLK speed for those MCUs is 250 MHz anyway. Also the comment on the line 2405 incorrectly mentions 200 MHz instead of 250 MHz.
In addition for HCLK frequencies below 20 MHz the code sets the divider to the highest value, which is the worst possible one. Instead it should set it to the appropriate or lowest possible value. For Fx series that means setting the divider to 16, but for Hx series the divider can be as low as 4. While very low HCLK frequencies are not appropriate for MAC operation, they are still valid for MDIO operation and PHY configuration, which could be useful for some projects.
And, as almost always, this HAL code is just plain stupid. Not only the first (hclk >= 20000000U) is damaging, but all of the (hclk >= ...) conditions are just useless and increases the bloat. The code clearly shows that the developer doesn't really understand even the basic logic operations.
