Skip to content

Commit d72b68c

Browse files
committed
stm32cube: stm32mp13xx: ethernet adapt ref clock enum
Today the RMII Reference clock enum is not instance agnostic. As it is done for other enumerations, this is up to the HAL to apply the configuration on the right Ethernet instance. If not, upper layers have to handle it themselves, that is not their role. Adapt ETH_ClkSrcTypeDef enum to add generic values, and create aliases for retro compatibility. Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
1 parent ad6ac61 commit d72b68c

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

stm32cube/stm32mp13xx/README

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,14 @@ Patch List:
7373
drivers/src/stm32mp13xx_hal_dfsdm.c
7474
ST Internal Reference: HAL1-27454
7575

76+
*ethernet: Modify RMII reference clock enumeration
77+
The way the HAL implements the ETH_ClkSrcTypeDef is not instance
78+
agnostic. Add generic enum members that can target either ETH1 or
79+
ETH2. The HAL driver is responsible to know on which controller
80+
instance we are.
81+
Impacted file:
82+
stm32cube/stm32mp13xx/drivers/include/stm32mp13xx_hal_eth.h
83+
stm32cube/stm32mp13xx/drivers/src/stm32mp13xx_hal_eth.c
84+
Internal reference: HAL1-27631
85+
7686
See release_note.html from STM32Cube

stm32cube/stm32mp13xx/drivers/include/stm32mp13xx_hal_eth.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,13 @@ typedef enum
414414
*/
415415
typedef enum
416416
{
417-
HAL_ETH1_REF_CLK_RCC = 0x00U, /*!< ETH1 reference clock (RMII mode) comes from the RCC */
418-
HAL_ETH1_REF_CLK_RX_CLK_PIN = 0x01U, /*!< ETH1 reference clock (RMII mode) comes from the ETH2_RX_CLK/ETH2_REF_CLK pin */
419-
HAL_ETH2_REF_CLK_RCC = 0x02U, /*!< ETH2 reference clock (RMII mode) comes from the RCC */
420-
HAL_ETH2_REF_CLK_RX_CLK_PIN = 0x03U, /*!< ETH2 reference clock (RMII mode) comes from the ETH2_RX_CLK/ETH2_REF_CLK pin */
417+
HAL_ETH_REF_CLK_RCC = 0x00U, /*!< ETH1/2 reference clock (RMII mode) comes from the RCC */
418+
HAL_ETH_REF_CLK_RX_CLK_PIN = 0x01U, /*!< ETH1/2 reference clock (RMII mode) comes from the ETH_RX_CLK/ETH_REF_CLK pin */
419+
420+
HAL_ETH1_REF_CLK_RCC = HAL_ETH_REF_CLK_RCC,
421+
HAL_ETH1_REF_CLK_RX_CLK_PIN = HAL_ETH_REF_CLK_RX_CLK_PIN,
422+
HAL_ETH2_REF_CLK_RCC = HAL_ETH_REF_CLK_RCC,
423+
HAL_ETH2_REF_CLK_RX_CLK_PIN = HAL_ETH_REF_CLK_RX_CLK_PIN
421424
} ETH_ClkSrcTypeDef;
422425

423426
/**

stm32cube/stm32mp13xx/drivers/src/stm32mp13xx_hal_eth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
369369
if (heth->Instance == ETH)
370370
{
371371
syscfg_config = SYSCFG_ETH1_RMII;
372-
if (heth->Init.ClockSelection == HAL_ETH1_REF_CLK_RCC)
372+
if (heth->Init.ClockSelection == HAL_ETH_REF_CLK_RCC)
373373
{
374374
syscfg_config |= SYSCFG_PMCSETR_ETH1_REF_CLK_SEL;
375375
}
@@ -378,7 +378,7 @@ HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)
378378
else
379379
{
380380
syscfg_config = SYSCFG_ETH2_RMII;
381-
if (heth->Init.ClockSelection == HAL_ETH2_REF_CLK_RCC)
381+
if (heth->Init.ClockSelection == HAL_ETH_REF_CLK_RCC)
382382
{
383383
syscfg_config |= SYSCFG_PMCSETR_ETH2_REF_CLK_SEL;
384384
}

0 commit comments

Comments
 (0)