stm32h7: allow Ethernet MAC without PHY
- In some cases, an operational Ethernet MAC may have no PHY, for example when the system has a direct RMII MAC-to-MAC link. - New config option STM32H7_NO_PHY - With this option, PHY-specific code in the ethernet driver is not built - This option is inherently incompatible with autonegotiation and speed and duplex settings must be compiled in
This commit is contained in:
parent
596aa1d51b
commit
769e65ef8e
@ -5519,6 +5519,10 @@ config STM32H7_ETHMAC_REGDEBUG
|
||||
Enable very low-level register access debug. Depends on
|
||||
CONFIG_DEBUG_FEATURES.
|
||||
|
||||
config STM32H7_NO_PHY
|
||||
bool "MAC has no PHY"
|
||||
default n
|
||||
|
||||
endmenu # Ethernet MAC configuration
|
||||
|
||||
if STM32H7_LTDC
|
||||
|
@ -748,7 +748,7 @@ static void stm32_rxdescinit(struct stm32_ethmac_s *priv,
|
||||
union stm32_desc_u *rxtable, uint8_t *rxbuffer);
|
||||
|
||||
/* PHY Initialization */
|
||||
|
||||
#ifndef CONFIG_STM32H7_NO_PHY
|
||||
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
|
||||
static int stm32_phyintenable(struct stm32_ethmac_s *priv);
|
||||
#endif
|
||||
@ -763,6 +763,7 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv);
|
||||
#ifdef CONFIG_STM32H7_ETHMAC_REGDEBUG
|
||||
static void stm32_phyregdump(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* MAC/DMA Initialization */
|
||||
|
||||
@ -2942,6 +2943,7 @@ static void stm32_rxdescinit(struct stm32_ethmac_s *priv,
|
||||
#ifdef CONFIG_NETDEV_PHY_IOCTL
|
||||
static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg)
|
||||
{
|
||||
#ifndef CONFIG_STM32H7_NO_PHY
|
||||
#ifdef CONFIG_ARCH_PHY_INTERRUPT
|
||||
struct stm32_ethmac_s *priv = (struct stm32_ethmac_s *)dev->d_private;
|
||||
#endif
|
||||
@ -2999,9 +3001,13 @@ static int stm32_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg)
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return -EIO;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_NETDEV_PHY_IOCTL */
|
||||
|
||||
#ifndef CONFIG_STM32H7_NO_PHY
|
||||
/****************************************************************************
|
||||
* Function: stm32_phyintenable
|
||||
*
|
||||
@ -3522,6 +3528,8 @@ static int stm32_phyinit(struct stm32_ethmac_s *priv)
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_selectmii
|
||||
*
|
||||
@ -4091,6 +4099,19 @@ static int stm32_ethconfig(struct stm32_ethmac_s *priv)
|
||||
|
||||
/* Initialize the PHY */
|
||||
|
||||
#ifdef CONFIG_STM32H7_NO_PHY
|
||||
ninfo("MAC without PHY\n");
|
||||
#ifdef CONFIG_STM32H7_ETHFD
|
||||
priv->fduplex = 1;
|
||||
#else
|
||||
priv->fduplex = 0;
|
||||
#endif
|
||||
#ifdef CONFIG_STM32H7_ETH100MBPS
|
||||
priv->mbps100 = 1;
|
||||
#else
|
||||
priv->mbps100 = 0;
|
||||
#endif
|
||||
#else
|
||||
ninfo("Initialize the PHY\n");
|
||||
ret = stm32_phyinit(priv);
|
||||
if (ret < 0)
|
||||
@ -4098,6 +4119,7 @@ static int stm32_ethconfig(struct stm32_ethmac_s *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Initialize the MAC and DMA */
|
||||
|
||||
ninfo("Initialize the MAC and DMA\n");
|
||||
|
Loading…
Reference in New Issue
Block a user