dts: bindings: ethernet-controller: Add phy mode

Add a property to the ethernet controller binding
indicating what type of connection the MAC has with
the PHY device.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
Declan Snyder 2023-09-27 12:08:32 -05:00 committed by David Leach
parent 4a8d9a1ef3
commit 7e88ab54e2
6 changed files with 29 additions and 35 deletions

View file

@ -217,7 +217,9 @@ int eth_esp32_initialize(const struct device *dev)
/* Configure phy for Media-Independent Interface (MII) or
* Reduced Media-Independent Interface (RMII) mode
*/
const char *phy_connection_type = DT_INST_PROP(0, phy_connection_type);
const char *phy_connection_type = DT_INST_PROP_OR(0,
phy_connection_type,
"rmii");
if (strcmp(phy_connection_type, "rmii") == 0) {
emac_hal_iomux_init_rmii();

View file

@ -133,6 +133,8 @@ static inline void dcache_clean(uint32_t addr, uint32_t size)
#endif
#endif /* !CONFIG_NET_TEST */
BUILD_ASSERT(DT_INST_ENUM_IDX(0, phy_connection_type) <= 1, "Invalid PHY connection");
/* RX descriptors list */
static struct gmac_desc rx_desc_que0[MAIN_QUEUE_RX_DESC_COUNT]
__nocache __aligned(GMAC_DESC_ALIGNMENT);
@ -1113,7 +1115,15 @@ static int gmac_init(Gmac *gmac, uint32_t gmac_ncfgr_val)
/* Setup Network Configuration Register */
gmac->GMAC_NCFGR = gmac_ncfgr_val | mck_divisor;
gmac->GMAC_UR = DT_INST_ENUM_IDX(0, phy_connection_type);
switch (DT_INST_ENUM_IDX_OR(0, phy_connection_type, 1)) {
case 0: /* mii */
gmac->GMAC_UR = 0x1;
case 1: /* rmii */
gmac->GMAC_UR = 0x0;
default:
/* Build assert at top of file should catch this case */
return -EINVAL;
}
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
/* Initialize PTP Clock Registers */

View file

@ -43,19 +43,9 @@ properties:
gmac driver supports 10Mbit/s and 100Mbit/s. Using 100, as default
value, enables driver to configure 10 and 100Mbit/s speeds.
phy-connection-type:
type: string
enum:
- "rmii"
- "mii"
default: "rmii"
description: |
Phy connection type define the physical interface connection between
PHY and MAC. The default value uses gmac register reset value, which
represents Reduced Media-Independent Interface (RMII) mode.
This property must be used with pinctrl-0.
mac-eeprom:
type: phandle
description: phandle to I2C eeprom device node.
phy-connection-type:
default: "rmii"

View file

@ -9,15 +9,8 @@ include:
- name: ethernet-controller.yaml
properties:
phy-connection-type:
type: string
enum:
- "rmii"
- "mii"
default: "rmii"
description: |
Phy connection type define the physical interface connection between
PHY and MAC. The default value uses Reduced Media-Independent
Interface (RMII) mode.
phy-handle:
required: true
phy-connection-type:
default: "rmii"

View file

@ -27,3 +27,12 @@ properties:
type: phandle
description: |
Specifies a reference to a node representing a PHY device.
phy-connection-type:
type: string
description: |
Specifies the interface connection type between ethernet MAC and PHY.
enum:
- "mii"
- "rmii"
- "gmii"

View file

@ -16,13 +16,3 @@ properties:
interrupt-names:
required: true
phy-connection-type:
type: string
enum:
- "mii"
- "rmii"
- "rgmii"
description: |
Specifies interface type between the Ethernet device and a physical
layer (PHY) device.