Skip to content

Conversation

@TonyHan11
Copy link
Contributor

@TonyHan11 TonyHan11 commented May 28, 2025

This PR includes:

  • add the driver for Microchip KSZ9131 Ethernet PHY
  • add interrupt mode support for KSZ8081

@pdgendt
Copy link
Contributor

pdgendt commented May 28, 2025

@TonyHan11 TonyHan11 force-pushed the phy_ksz9131_ksz8081 branch from 6944d51 to 5055226 Compare May 28, 2025 08:09
@TonyHan11
Copy link
Contributor Author

@pdgendt An entry for ksz9131 added to tests/drivers/build_all/ethernet/app.overlay, thanks.

@maass-hamburg
Copy link
Member

@TonyHan11 pls add PR description and address the things from sonarqube

@TonyHan11
Copy link
Contributor Author

@maass-hamburg updated with removing the unused property, renaming LINK_*BASED_T and fixing if (ret), thank you very much.

@TonyHan11 TonyHan11 force-pushed the phy_ksz9131_ksz8081 branch from 5055226 to cfd8c64 Compare May 29, 2025 01:21
@TonyHan11 TonyHan11 force-pushed the phy_ksz9131_ksz8081 branch 4 times, most recently from 1ac4658 to e7778f7 Compare June 3, 2025 04:41
@TonyHan11
Copy link
Contributor Author

@maass-hamburg
Thank you for your comments. Commits updated with the following changes:

  • using goto instead of do while (0)
  • update if (ret) to if (ret < 0)
  • fix the issues reported by SonarQube Cloud
  • remove comments TODO change this to GPIO interrupt driven

@TonyHan11 TonyHan11 force-pushed the phy_ksz9131_ksz8081 branch 2 times, most recently from ffe8e46 to 94224d7 Compare June 9, 2025 04:51
@TonyHan11
Copy link
Contributor Author

Resolve the CI error by rebasing the commits (without changes).

@TonyHan11 TonyHan11 requested a review from maass-hamburg June 9, 2025 05:30
@TonyHan11 TonyHan11 force-pushed the phy_ksz9131_ksz8081 branch from 94224d7 to 35d32e6 Compare June 10, 2025 09:27
maass-hamburg
maass-hamburg previously approved these changes Jun 10, 2025
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);
Copy link
Contributor

@kartben kartben Jun 26, 2025

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gpio_init_callback(&data->gpio_callback, phy_mc_ksz8081_interrupt_handler,
ret = gpio_init_callback(&data->gpio_callback, phy_mc_ksz8081_interrupt_handler,

@TonyHan11
Copy link
Contributor Author

Hi @nandojve ,

Hi @TonyHan11 ,

Is this still relevant to v4.3 ?

Yes, we hope it be merged to v4.3.
I rebased the commits to totay's main branch with 2 errors raised by DevicetreeLinting fixed. Also add some commits on it for supporting the GMAC0 which uses KSZ9131 as the PHY.

nandojve
nandojve previously approved these changes Oct 24, 2025
Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a general look and LGTM!

@nandojve
Copy link
Member

Ping @pdgendt , @maass-hamburg , @kartben .

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 <[email protected]>
New lines are expected between PHY nodes by DevicetreeLinting.

Signed-off-by: Tony Han <[email protected]>
Add build tests for Microchip KSZ9131.

Signed-off-by: Tony Han <[email protected]>
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 <[email protected]>
Read gigabit status from Master Slave Status Register.

Signed-off-by: Tony Han <[email protected]>
Get the link state in the monitor and save it for get_link api
implementation to use.

Signed-off-by: Tony Han <[email protected]>
Add gmac1 and gmac1_mdio nodes.

Signed-off-by: Tony Han <[email protected]>
Enable strong ordered access to the GMAC0 registers.

Signed-off-by: Tony Han <[email protected]>
Configure the generic clocks to 125MHz for GMAC0.

Signed-off-by: Tony Han <[email protected]>
Update to use the RGMII mode which is supported by SAMA7G54.

Signed-off-by: Tony Han <[email protected]>
Remove extra new lines to satisfy the requirement of DevicetreeLinting.

Signed-off-by: Tony Han <[email protected]>
Enable gmac0, gmac0_mdio and gmac0_phy nodes.

Signed-off-by: Tony Han <[email protected]>
@sonarqubecloud
Copy link

@cfriedt cfriedt merged commit 18d8ee5 into zephyrproject-rtos:main Oct 24, 2025
28 checks passed
@TonyHan11 TonyHan11 deleted the phy_ksz9131_ksz8081 branch October 27, 2025 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs area: Devicetree Bindings area: Ethernet area: Tests Issues related to a particular existing or missing test platform: Microchip MEC Microchip MEC Platform platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants