Skip to content

Conversation

matiamic
Copy link

Summary

This patch adds mdio_phy_id_c45 macro. This macro allows encoding of additional information needed for MDIO Manageable Device (MMD) access into the phy_id field of the mii_ioctl_data_s structure. This macro is intended for use by user applications.

This patch also adds macros for decoding the phy_id encoded with the mdio_phy_id_c45 macro. These macros are intended for use by network drivers implementing SIOCxMIIREG commands.

The mechanism is inspired by the approach used in Linux:
https://elixir.bootlin.com/linux/v6.16.3/source/include/uapi/linux/mdio.h#L456-L465
https://elixir.bootlin.com/linux/v6.16.3/source/include/linux/mdio.h#L110-L123

This PR was preceded by discussion in PR #16911

Impact

Network drivers now may implement access to MMD registers through ioctl.

Testing

The testing was performed by a testing application during development of a driver for 10BASE-T1x SPI MAC-PHYs.
A mirrored bit between two registers - one in MII interface, second in an MMD space - was written to. The bit enables / disables the PHY. Same effect was observed when accessing the bit using MII and MMD.

@github-actions github-actions bot added Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small labels Aug 28, 2025
@xiaoxiang781216
Copy link
Contributor

please fix the style warning:

 ../nuttx/tools/checkpatch.sh -c -u -m -g c36d0676033d84828ca06628ce5750d3b916a6af..HEAD
Used config files:
    1: .codespellrc
Error: /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/net/netdev.h:5:83: error: Long line found
Error: Process completed with exit code 1.

jerpelea
jerpelea previously approved these changes Aug 28, 2025
@matiamic
Copy link
Author

matiamic commented Aug 28, 2025

please fix the style warning:

@xiaoxiang781216 The warning is in the license banner in SPDX tag-value line. A short search indicates that SPDX tag-value must be entirely on a single line. Another option may be shortening the line maybe? I might need a bit of help on this.

https://spdx.github.io/spdx-spec/v2.3/file-tags/:

An SPDX file tag consists of a single line, generally as part of a comment near the top of the file

Multiple-line values are not recommended, because doing so will make it harder for simple search tools to extract all data by looking only for lines beginning with the relevant tag.

@ppisa
Copy link
Contributor

ppisa commented Aug 28, 2025

@xiaoxiang781216 It is the original line unmodified by the patch. Its correction is problematic as specified by @matiamic and this style update should not be mixed with functionality added by this patch. So my personal opinion is that it needs to be ignored now.

@simbit18
Copy link
Contributor

please fix the style warning:

@xiaoxiang781216 The warning is in the license banner in SPDX tag-value line. A short search indicates that SPDX tag-value must be entirely on a single line. Another option may be shortening the line maybe? I might need a bit of help on this.

https://spdx.github.io/spdx-spec/v2.3/file-tags/:

An SPDX file tag consists of a single line, generally as part of a comment near the top of the file

Multiple-line values are not recommended, because doing so will make it harder for simple search tools to extract all data by looking only for lines beginning with the relevant tag.

Hi @matiamic possible solution as is done in other files
https://github.com/apache/nuttx/blob/master/arch/arm/src/lpc2378/lpc23xx_i2c.c#L7-#L9

Add mdio_phy_id_c45 macro. This macro allows encoding of additional information
needed for MMD access into the phy_id field of the mii_ioctl_data_s structure.
This macro is intended for use by user applications.

Add macros for decoding the phy_id encoded with the mdio_phy_id_c45 macro.
These macros are intended for use by network drivers implementing
SIOCxMIIREG commands.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
@matiamic matiamic requested a review from jerpelea August 28, 2025 16:22
@ppisa
Copy link
Contributor

ppisa commented Aug 28, 2025

Please, can somebody approve this change ( for example @acassis ) to allow @matiamic to continue with main OpenAliance T1S pull request preparation/posting as his GSoC final report reference?

The failed check is in the line not touched by patch. If it should be resolved, it can be done latter as some formatting change.

@acassis
Copy link
Contributor

acassis commented Aug 28, 2025

@ppisa I force the re-run of the failed job. Unfortunately our CI is very unstable, sometime it fails because download error, like temporary 502 error that normally we see in the browser. In our browser we just try again, in the CI it just fails and never try again

@simbit18 simbit18 merged commit 8fc63aa into apache:master Aug 29, 2025
74 of 75 checks passed
@xiaoxiang781216
Copy link
Contributor

#16940 (review)
@matiamic @ppisa this patch add d_features to allow the driver provide the hardware capability to net subsystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants