drivers: eth: sam_gmac: Fix phy layer setup

The current setup of physical layer forces RMII interface. The code was
refactored to have only one point to select proper phy interface. Now,
GMAC driver works with both RMII or MII interface. The phy connection
type is now selected by device tree. The default phy connection is RMII.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2020-02-19 23:52:10 -03:00 committed by Jukka Rissanen
commit 3c4fbfddf5
2 changed files with 1 additions and 14 deletions

View file

@ -120,16 +120,6 @@ config ETH_SAM_GMAC_MAC_I2C_DEV_NAME
endif # ETH_SAM_GMAC_MAC_I2C_EEPROM
choice
prompt "MII/RMII Interface to the Physical Layer"
config ETH_SAM_GMAC_RMII
bool "RMII"
config ETH_SAM_GMAC_MII
bool "MII"
endchoice
config ETH_SAM_GMAC_PHY_ADDR
int "GMAC PHY Address"
default 0

View file

@ -1091,10 +1091,7 @@ static int gmac_init(Gmac *gmac, u32_t gmac_ncfgr_val)
/* Setup Network Configuration Register */
gmac->GMAC_NCFGR = gmac_ncfgr_val | mck_divisor;
#ifdef CONFIG_ETH_SAM_GMAC_MII
/* Setup MII Interface to the Physical Layer, RMII is the default */
gmac->GMAC_UR = GMAC_UR_RMII; /* setting RMII to 1 selects MII mode */
#endif
gmac->GMAC_UR = DT_ENUM_IDX(DT_NODELABEL(gmac), phy_connection_type);
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
/* Initialize PTP Clock Registers */