Commit 64b205af authored by Dmitry Konyshev's avatar Dmitry Konyshev

RT #84530 Ethernet in Linux for STM-SOM does not come up if no network command...

RT #84530 Ethernet in Linux for STM-SOM does not come up if no network command is executed in U-boot
parent d5251160
......@@ -378,6 +378,7 @@ s32 stm32_eth_init(bd_t *bd)
struct stm_eth_dev *mac;
struct eth_device *netdev;
s32 rv;
u32 val;
mac = malloc(sizeof(struct stm_eth_dev));
if (!mac) {
......@@ -388,6 +389,23 @@ s32 stm32_eth_init(bd_t *bd)
}
memset(mac, 0, sizeof(struct stm_eth_dev));
/*
* Enable SYSCFG clock
*/
STM32_RCC->apb2enr |= STM32_RXX_ENR_SYSCFG;
/*
* Set MII mode
*/
val = STM32_SYSCFG->pmc;
val &= STM32_SYSCFG_PMC_SEL_MSK << STM32_SYSCFG_PMC_SEL_BIT;
#ifndef CONFIG_STM32_ETH_RMII
val |= STM32_SYSCFG_PMC_SEL_MII << STM32_SYSCFG_PMC_SEL_BIT;
#else
val |= STM32_SYSCFG_PMC_SEL_RMII << STM32_SYSCFG_PMC_SEL_BIT;
#endif
STM32_SYSCFG->pmc = val;
netdev = &mac->netdev;
/*
......@@ -784,7 +802,6 @@ static s32 stm_mac_gpio_init(struct stm_eth_dev *mac)
{
static s32 gpio_inited;
u32 val;
s32 i, rv;
/*
......@@ -800,23 +817,6 @@ static s32 stm_mac_gpio_init(struct stm_eth_dev *mac)
goto out;
}
/*
* Enable SYSCFG clock
*/
STM32_RCC->apb2enr |= STM32_RXX_ENR_SYSCFG;
/*
* Set MII mode
*/
val = STM32_SYSCFG->pmc;
val &= STM32_SYSCFG_PMC_SEL_MSK << STM32_SYSCFG_PMC_SEL_BIT;
#ifndef CONFIG_STM32_ETH_RMII
val |= STM32_SYSCFG_PMC_SEL_MII << STM32_SYSCFG_PMC_SEL_BIT;
#else
val |= STM32_SYSCFG_PMC_SEL_RMII << STM32_SYSCFG_PMC_SEL_BIT;
#endif
STM32_SYSCFG->pmc = val;
/*
* Set GPIOs Alternative function
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment