Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: teensy4: Add ethernet functionality #78417

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions boards/pjrc/teensy4/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ config BUILD_OUTPUT_HEX
config DISK_DRIVER_SDMMC
default y if DISK_DRIVERS

if NETWORKING

config NET_L2_ETHERNET
default n if BOARD_TEENSY40
default y if BOARD_TEENSY41

endif # NETWORKING

endif # BOARD_TEENSY40 || BOARD_TEENSY41
48 changes: 24 additions & 24 deletions boards/pjrc/teensy4/teensy4-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, NXP
* Copyright (c) 2024, Bernhard Kraemer
* SPDX-License-Identifier: Apache-2.0
*
* Note: File generated by gen_board_pinctrl.py
Expand All @@ -12,41 +13,40 @@
/* Mode Straps configuration DP83825 */
pinmux_enet: pinmux_enet {
group0 {
pinmux = <&iomuxc_gpio_b1_10_enet_ref_clk>;
bias-disable;
drive-strength = "r0-6";
slew-rate = "slow";
nxp,speed = "100-mhz";
input-enable;
};
group1 {
pinmux = <&iomuxc_gpio_b1_04_enet_rx_data0>,
<&iomuxc_gpio_b1_05_enet_rx_data1>,
<&iomuxc_gpio_b1_06_enet_rx_en>,
<&iomuxc_gpio_b1_07_enet_tx_data0>,
<&iomuxc_gpio_b1_08_enet_tx_data1>,
<&iomuxc_gpio_b1_09_enet_tx_en>,
<&iomuxc_gpio_b1_11_enet_rx_er>;
drive-strength = "r0-5";
bias-pull-down;
bias-pull-down-value = "100k";
slew-rate = "fast";
nxp,speed = "200-mhz";
};
group1 {
pinmux = <&iomuxc_gpio_b1_05_enet_rx_data1>;
drive-strength = "r0-5";
bias-pull-up;
bias-pull-up-value = "22k";
bias-pull-up-value = "100k";
slew-rate = "fast";
nxp,speed = "200-mhz";
};
group2 {
pinmux = <&iomuxc_gpio_b1_07_enet_tx_data0>,
<&iomuxc_gpio_b1_08_enet_tx_data1>,
<&iomuxc_gpio_b1_09_enet_tx_en>,
<&iomuxc_gpio_b1_14_enet_mdc>,
};

pinmux_enet_mdio: pinmux_enet_mdio {
group0 {
pinmux = <&iomuxc_gpio_b1_14_enet_mdc>,
<&iomuxc_gpio_b1_15_enet_mdio>,
<&iomuxc_gpio_b0_15_gpio2_io15>,
<&iomuxc_gpio_b0_14_gpio2_io14>;
drive-strength = "r0-6";
slew-rate = "slow";
nxp,speed = "100-mhz";
};
group3 {
pinmux = <&iomuxc_gpio_b1_10_enet_ref_clk>;
drive-strength = "r0-6";
slew-rate = "slow";
nxp,speed = "100-mhz";
input-enable;
drive-strength = "r0-5";
bias-pull-up;
bias-pull-up-value = "100k";
slew-rate = "fast";
nxp,speed = "200-mhz";
};
};

Expand Down
18 changes: 1 addition & 17 deletions boards/pjrc/teensy4/teensy40.dts
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,8 @@ zephyr_udc0: &usb1 {
status = "okay";
};

/* Pinmux settings */
&enet_mac {
pinctrl-0 = <&pinmux_enet>;
pinctrl-names = "default";
zephyr,random-mac-address;
phy-connection-type = "rmii";
phy-handle = <&phy>;
};

&enet_mdio {
&edma0 {
status = "okay";
pinctrl-0 = <&pinmux_enet>;
pinctrl-names = "default";
phy: phy@0 {
compatible = "ethernet-phy";
reg = <0>;
status = "okay";
};
};

&flexcan1 {
Expand Down
23 changes: 23 additions & 0 deletions boards/pjrc/teensy4/teensy41.dts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@
};
};

&enet_mac {
status = "okay";
pinctrl-0 = <&pinmux_enet>;
pinctrl-names = "default";
nxp,unique-mac;
phy-connection-type = "rmii";
phy-handle = <&phy>;
};

&enet_mdio {
status = "okay";
pinctrl-0 = <&pinmux_enet_mdio>;
pinctrl-names = "default";
phy: phy@0 {
status = "okay";
compatible = "ti,dp83825";
reg = <0>;
reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
int-gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
ti,interface-type = "rmii";
};
};

&lpspi3 {
status = "okay";
};
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 @@ -4,5 +4,6 @@ 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_TJA1103 phy_tja1103.c)
zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_KSZ8081 phy_microchip_ksz8081.c)
zephyr_library_sources_ifdef(CONFIG_PHY_TI_DP83825 phy_ti_dp83825.c)
zephyr_library_sources_ifdef(CONFIG_PHY_REALTEK_RTL8211F phy_realtek_rtl8211f.c)
zephyr_library_sources_ifdef(CONFIG_PHY_QUALCOMM_AR8031 phy_qualcomm_ar8031.c)
9 changes: 9 additions & 0 deletions drivers/ethernet/phy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ config PHY_MICROCHIP_KSZ8081
help
Enable Microchip KSZ8081 Ethernet PHY Driver

config PHY_TI_DP83825
bool "TI DP83825 PHY Driver"
default y
depends on DT_HAS_TI_DP83825_ENABLED
depends on MDIO
depends on GPIO
help
Enable TI DP83825 Ethernet PHY Driver

config PHY_REALTEK_RTL8211F
bool "Realtek RTL8211F PHY Driver"
default y
Expand Down
Loading
Loading