matiamic commented on PR #16999:
URL: https://github.com/apache/nuttx/pull/16999#issuecomment-3290025883

   > Great, then I see here two approaches:
   > 
   >   - I'll update the Kconfig file with an clause choice, so the phy driver 
(or user) can y select c22, c45, or both. I'll update mdio bus so it provides 
independent mdio_read/write_c22 and mdio_read/write_c45, each guarded by the 
choice above.
   > 
   >   - I'll add a new an new parameter (enum or int) to mdio_bus_s to specify 
what clauses it supports. I'll add the prtad parameter to the function 
signature, and pass it as NULL if c22 is used.
   
   For the second approach it might be worth considering the encoding 
introduced in https://github.com/apache/nuttx/pull/16926: Add mechanism for MMD 
access with SIOCxMIIREG ioctls. Usage in driver 
[here](https://github.com/apache/nuttx/blob/71f558765c7d53d0dad001cd1617d7f6ecf23c8c/drivers/net/oa_tc6/oa_tc6.c#L1828).
   
   But special functions for c22 and c45 seem clearer. As seen in [`mii_bus` 
struct in 
Linux](https://elixir.bootlin.com/linux/v6.16.7/source/include/linux/phy.h#L334).
   
   I think the inclusion of the c45 functionality from the start would be nice. 
As @ppisa noted it is needed for configuration of the PLCA in 10BASE-T1S PHYs.
   
   > At the first glance.
   > I see the ioctl function mapping, and it currently returning 
OA_TC6_IOCTL_CMD_NOT_IMPLEMENTED.
   
   You are probably looking into chip-specific drivers. The MDIO access in 
question is implemented in the generic driver 
[here](https://github.com/apache/nuttx/blob/71f558765c7d53d0dad001cd1617d7f6ecf23c8c/drivers/net/oa_tc6/oa_tc6.c#L1820).
   
   > Also, talking about mac-phy, mac is onboard the external chip, so your 
lowerhalf mdio bus implementation will be managing spi translations, some part 
of the Control transactions, if i understand correctly. I'm not even sure that 
having a explicit mdio bus would help you, maybe is easier just to treat 
everything as spi data regardless if it is Ethernet MAC Frame data transactions 
or Control transactions. I'll need more time to read the datasheets.
   
   I think you are right, having explicit mdio bus would not help here. If I 
understand correctly, your concern is to provide standard way of exchanging 
configuration between MAC drivers and external PHYs. The concern of the OA-TC6 
driver in this regard is to expose MMD registers to user apps (such as 
[`plcatool`](https://github.com/apache/nuttx-apps/pull/3181)) - at this moment 
the direct implementation of the SIOCxMIIREG ioctls seems like the best option.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to