forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teensy 4.1 port with Ethernet support (#144)
* Start porting to Teensy 4.1, also fix some compiler warnings in FSL HAL * Add hardware init for Teensy, refactor phy drivers, rework IMX EMAC autonegotiate code * Revert some testing changes * Fix incorrect phy address used outside of low_level_init_successful() * Ethernet operational! * Turn off DEBUG_IMX_EMAC * Style fixes * Style again * Bugfix: mbed_lib.json files in project source dir were not getting picked up * Bugfix: CLion debug configurations not generated properly due to variables going out of scope * Support Teensy OTP MAC address
- Loading branch information
1 parent
bf5be9f
commit af6d50a
Showing
31 changed files
with
993 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
target_sources(mbed-emac | ||
PRIVATE | ||
hardware_init.c | ||
fsl_phy_ksz8081rnb.c | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/TARGET_MIMXRT105x_EVK/ksz8081rnb_regs.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
* Copyright 2016-2017 NXP | ||
* All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
#ifndef _KSZ8081RNB_REGS_H_ | ||
#define _KSZ8081RNB_REGS_H_ | ||
|
||
/*! @brief Defines the KSZ8081-specific PHY registers. */ | ||
#define PHY_CONTROL1_REG 0x1EU /*!< The PHY control one register. */ | ||
#define PHY_CONTROL2_REG 0x1FU /*!< The PHY control two register. */ | ||
|
||
#define PHY_CONTROL_ID1 0x22U /*!< The PHY ID1*/ | ||
|
||
/*!@brief Defines the mask flag of operation mode in control two register*/ | ||
#define PHY_CTL2_REMOTELOOP_MASK 0x0004U /*!< The PHY remote loopback mask. */ | ||
#define PHY_CTL2_REFCLK_SELECT_MASK 0x0080U /*!< The PHY RMII reference clock select. */ | ||
#define PHY_CTL1_10HALFDUPLEX_MASK 0x0001U /*!< The PHY 10M half duplex mask. */ | ||
#define PHY_CTL1_100HALFDUPLEX_MASK 0x0002U /*!< The PHY 100M half duplex mask. */ | ||
#define PHY_CTL1_10FULLDUPLEX_MASK 0x0005U /*!< The PHY 10M full duplex mask. */ | ||
#define PHY_CTL1_100FULLDUPLEX_MASK 0x0006U /*!< The PHY 100M full duplex mask. */ | ||
#define PHY_CTL1_SPEEDUPLX_MASK 0x0007U /*!< The PHY speed and duplex mask. */ | ||
#define PHY_CTL1_ENERGYDETECT_MASK 0x10U /*!< The PHY signal present on rx differential pair. */ | ||
#define PHY_CTL1_LINKUP_MASK 0x100U /*!< The PHY link up. */ | ||
#define PHY_LINK_READY_MASK (PHY_CTL1_ENERGYDETECT_MASK | PHY_CTL1_LINKUP_MASK) | ||
|
||
#endif |
8 changes: 8 additions & 0 deletions
8
connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/TARGET_TEENSY_41/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
target_sources(mbed-emac | ||
PRIVATE | ||
hardware_init.cpp | ||
fsl_phy_dp83825.c | ||
) |
53 changes: 53 additions & 0 deletions
53
connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_IMX/TARGET_TEENSY_41/dp83825_regs.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
* Copyright 2016-2017 NXP | ||
* All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
#ifndef _DP83825_REGS_H_ | ||
#define _DP83825_REGS_H_ | ||
|
||
/*! @brief Defines the DP83825-specific PHY registers. */ | ||
#define PHY_PHYSTS_REG 0x10 ///< Phy Status Reg | ||
#define PHY_BISCR_REG 0x16 ///< Built-In Self Test Control Register | ||
#define PHY_RCSR_REG 0x17 ///< Receive Clock Select Register | ||
#define PHY_LEDCR_REG 0x18 ///< LED Control Register | ||
|
||
#define PHY_CONTROL_ID1 0x2000U /*!< The PHY ID1*/ | ||
|
||
/*!@brief Defines the mask flag of operation mode in control two register*/ | ||
#define PHY_CTL2_REMOTELOOP_MASK 0x0004U /*!< The PHY remote loopback mask. */ | ||
#define PHY_CTL2_REFCLK_SELECT_MASK 0x0080U /*!< The PHY RMII reference clock select. */ | ||
#define PHY_CTL1_10HALFDUPLEX_MASK 0x0001U /*!< The PHY 10M half duplex mask. */ | ||
#define PHY_CTL1_100HALFDUPLEX_MASK 0x0002U /*!< The PHY 100M half duplex mask. */ | ||
#define PHY_CTL1_10FULLDUPLEX_MASK 0x0005U /*!< The PHY 10M full duplex mask. */ | ||
#define PHY_CTL1_100FULLDUPLEX_MASK 0x0006U /*!< The PHY 100M full duplex mask. */ | ||
#define PHY_CTL1_SPEEDUPLX_MASK 0x0007U /*!< The PHY speed and duplex mask. */ | ||
#define PHY_CTL1_ENERGYDETECT_MASK 0x10U /*!< The PHY signal present on rx differential pair. */ | ||
#define PHY_CTL1_LINKUP_MASK 0x100U /*!< The PHY link up. */ | ||
#define PHY_LINK_READY_MASK (PHY_CTL1_ENERGYDETECT_MASK | PHY_CTL1_LINKUP_MASK) | ||
|
||
// Bits for PHYSTS register | ||
#define PHY_PHYSTS_DUPLEX_Msk (1 << 2) | ||
#define PHY_PHYSTS_SPEED_Msk (1 << 1) | ||
|
||
// Bits for BISCR register | ||
#define PHY_BISCR_LOOPBACK_Msk (0b11111) | ||
#define PHY_BISCR_LOOPBACK_Pos 0 | ||
#define PHY_BISCR_LOOPBACK_DIGITAL_LOOPBACK_10M_Val 0x1 | ||
#define PHY_BISCR_LOOPBACK_DIGITAL_LOOPBACK_100M_Val 0x4 | ||
#define PHY_BISCR_LOOPBACK_ANALOG_LOOPBACK_Val 0x8 | ||
|
||
// Bits for RCSR register | ||
#define PHY_RCSR_RX_ELASTICITY_Pos 0 | ||
#define PHY_RCSR_RX_ELASTICITY_Msk 0b11 | ||
#define PHY_RCSR_RMII_CLK_SEL_Msk (1 << 7) | ||
|
||
// Bits for LEDCR register | ||
#define PHY_LEDCR_POLARITY_Msk (1 << 7) | ||
#define PHY_LEDCR_BLINK_RATE_Msk (0b11 << 9) | ||
#define PHY_LEDCR_BLINK_RATE_Pos 9 | ||
|
||
|
||
#endif |
Oops, something went wrong.