-
Notifications
You must be signed in to change notification settings - Fork 7.8k
drivers: ethernet: phy: add driver for ksz9131, update ksz8081 with interrupt support #90711
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
base: main
Are you sure you want to change the base?
Conversation
Add an entry to https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/drivers/build_all/ethernet/app.overlay so it builds in CI. |
6944d51
to
5055226
Compare
@pdgendt An entry for ksz9131 added to |
@TonyHan11 pls add PR description and address the things from sonarqube |
@maass-hamburg updated with removing the unused property, renaming |
5055226
to
cfd8c64
Compare
1ac4658
to
e7778f7
Compare
@maass-hamburg
|
ffe8e46
to
94224d7
Compare
Resolve the CI error by rebasing the commits (without changes). |
94224d7
to
35d32e6
Compare
reg_val |= PHY_KSZ9131_ICS_LINK_UP_IE_MASK | PHY_KSZ9131_ICS_LINK_DOWN_IE_MASK; | ||
|
||
/* Write settings to Interrupt Control/Status register */ | ||
ret = ksz9131_write(dev, 27, reg_val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use PHY_KSZ9131_ICS_REG macro instead of magic number
goto done; | ||
} | ||
|
||
gpio_init_callback(&data->gpio_callback, phy_mc_ksz8081_interrupt_handler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpio_init_callback(&data->gpio_callback, phy_mc_ksz8081_interrupt_handler, | |
ret = gpio_init_callback(&data->gpio_callback, phy_mc_ksz8081_interrupt_handler, |
8892b25
to
6f9aced
Compare
27c6e59
to
5a9a2c6
Compare
5a9a2c6
to
50f538d
Compare
Rebased to the latest |
struct k_work_delayable monitor_work; | ||
struct phy_link_state state; | ||
struct k_sem sem; | ||
bool gigabit_supported; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gigabit_supported bool is not needed, as this phy definetly supports gigabit and it be always be true, it is only in the generic phy driver, because there we don't know it because we don't know durring build if gigabit is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with removing gigabit_supported
and code related. Thanks.
50f538d
to
3e074d0
Compare
@TonyHan11 please rebase to current main |
3e074d0
to
a762fa7
Compare
rebased, thanks. |
LOG_ERR("PHY (%d) init failed", cfg->phy_addr); | ||
} | ||
|
||
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply changes from #91572 also to this phy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with adding default-speeds
for ksz9131, thanks.
ef7bf97
to
a2640e1
Compare
drivers/ethernet/phy/Kconfig
Outdated
depends on MDIO | ||
depends on GPIO || (!$(dt_compat_any_has_prop,$(DT_COMPAT_MICROCHIP_KSZ9131),reset-gpios) && \ | ||
!$(dt_compat_any_has_prop,$(DT_COMPAT_MICROCHIP_KSZ9131),int-gpios)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply changes from #94806
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and updated with the changes applied.
uint16_t anar = 0; | ||
int ret = 0; | ||
|
||
(void)config; /* avoid warnings due to config is only used in LOG_DBG() */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use __maybe_unused
attribute on config instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks.
goto done; | ||
} | ||
|
||
ret = phy_mchp_ksz9131_autonegotiate(dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding the changes from #93118 here too and using phy_mii_cfg_link_autoneg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve some of the logging.
No changes with auto-negotiate due to no block issue in ksz9131 using interrupt mode.
It seems that the interrupt mode for ksz8081 is not fully supported in the PR.
a2640e1
to
93fc888
Compare
93fc888
to
cc48784
Compare
|
Add support for KSZ9131 (Gigabit Ethernet Transceiver with RGMII Support). As first starter, 100MBit/s mode is tested. https://www.microchip.com/en-us/product/ksz9131 Signed-off-by: Tony Han <tony.han@microchip.com>
Add build tests for Microchip KSZ9131. Signed-off-by: Tony Han <tony.han@microchip.com>
Enable Link-Up and Link-Down interrupts. On the interrupt handling the monitor work is scheduled to update the link status and calling corresponding callback routine. Signed-off-by: Tony Han <tony.han@microchip.com>
Enable Link-Up and Link-Down interrupts. On the interrupt handling the monitor work is scheduled to update the link status and calling corresponding callback routine. Signed-off-by: Tony Han <tony.han@microchip.com>
Read gigabit status from Master Slave Status Register. Signed-off-by: Tony Han <tony.han@microchip.com>
This PR includes: