Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion boards/microchip/sam/sama7g54_ek/sama7g54_ek.dts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,28 @@
};
};

&gmac0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gmac0_default>;
phy-connection-type = "gmii";
phy-handle = <&gmac0_phy>;
};

&gmac0_mdio {
status = "okay";

pinctrl-0 = <&pinctrl_gmac0_mdio_default>;
pinctrl-names = "default";

gmac0_phy: ethernet-phy@7 {
compatible = "microchip,ksz9131";
status = "okay";
reg = <7>;
int-gpios = <&pioa 31 GPIO_ACTIVE_LOW>;
};
};

&gmac1 {
status = "okay";
pinctrl-names = "default";
Expand Down Expand Up @@ -182,6 +204,36 @@
};
};

pinctrl_gmac0_default: gmac0_default {
group1 {
pinmux = <PIN_PA16__G0_TX0>,
<PIN_PA17__G0_TX1>,
<PIN_PA26__G0_TX2>,
<PIN_PA27__G0_TX3>,
<PIN_PA19__G0_RX0>,
<PIN_PA20__G0_RX1>,
<PIN_PA28__G0_RX2>,
<PIN_PA29__G0_RX3>,
<PIN_PA15__G0_TXEN>,
<PIN_PA30__G0_RXCK>,
<PIN_PA18__G0_RXDV>,
<PIN_PA25__G0_125CK>;
bias-disable;
};

gmac0_txck_default {
pinmux = <PIN_PA24__G0_TXCK>;
bias-pull-up;
};
};

pinctrl_gmac0_mdio_default: gmac0_mdio_default {
group1 {
pinmux = <PIN_PA22__G0_MDC>,
<PIN_PA23__G0_MDIO>;
};
};

pinctrl_gmac1_default: gmac1_default {
group1 {
pinmux = <PIN_PD30__G1_TXCK>,
Expand Down Expand Up @@ -264,7 +316,6 @@
bias-pull-up;
};
};

};

&pit64b0 {
Expand Down
17 changes: 16 additions & 1 deletion drivers/ethernet/eth_sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,17 @@ 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");
/* if GMAC_UR_MIM_RGMII (new for sama7g5) is defined, the media interface mode
* supported are: mii, rmii and gmii. Otherwise mii and rmii are supported.
*/
#ifndef GMAC_UR_MIM_RGMII
#define SAM_GMAC_PHY_CONNECTION_TYPE_MAX 1
#else
#define SAM_GMAC_PHY_CONNECTION_TYPE_MAX 2
#endif

BUILD_ASSERT(DT_INST_ENUM_IDX(0, phy_connection_type) <= SAM_GMAC_PHY_CONNECTION_TYPE_MAX,
"Invalid PHY connection");

/* RX descriptors list */
static struct gmac_desc rx_desc_que0[MAIN_QUEUE_RX_DESC_COUNT]
Expand Down Expand Up @@ -1091,6 +1101,11 @@ static int gmac_init(Gmac *gmac, uint32_t gmac_ncfgr_val)
case 1: /* rmii */
gmac->GMAC_UR = 0x0;
break;
#ifdef GMAC_UR_MIM_RGMII
case 2: /* rgmii */
gmac->GMAC_UR = GMAC_UR_MIM_RGMII;
break;
#endif
default:
/* Build assert at top of file should catch this case */
LOG_ERR("The phy connection type is invalid");
Expand Down
1 change: 1 addition & 0 deletions drivers/ethernet/phy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ zephyr_library_sources_ifdef(CONFIG_PHY_GENERIC_MII phy_mii.c)
zephyr_library_sources_ifdef(CONFIG_PHY_ADIN2111 phy_adin2111.c)
zephyr_library_sources_ifdef(CONFIG_PHY_DM8806 phy_dm8806.c)
zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_KSZ8081 phy_microchip_ksz8081.c)
zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_KSZ9131 phy_microchip_ksz9131.c)
zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_T1S phy_microchip_t1s.c)
zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_VSC8541 phy_microchip_vsc8541.c)
zephyr_library_sources_ifdef(CONFIG_PHY_OA_TC14_PLCA_LIB phy_oa_tc14_plca.c)
Expand Down
9 changes: 9 additions & 0 deletions drivers/ethernet/phy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ config PHY_MICROCHIP_KSZ8081
help
Enable Microchip KSZ8081 Ethernet PHY Driver

config PHY_MICROCHIP_KSZ9131
bool "Microchip KSZ9131 PHY Driver"
default y
depends on DT_HAS_MICROCHIP_KSZ9131_ENABLED
select MDIO
select GPIO if $(dt_compat_any_has_prop,$(DT_COMPAT_MICROCHIP_KSZ9131),int-gpios)
help
Enable Microchip KSZ9131 Ethernet PHY Driver

config PHY_MICROCHIP_VSC8541
bool "Microchip VSC8541 PHY Driver"
default y
Expand Down
Loading