amaranth-boards
amaranth-boards copied to clipboard
Add RGMIIResource
Preparation for PR #148
Rebased on latest main.
Because the MDIO bus can support multiple PHYs it is often shared between PHYs (this is the case on all the colorlight boards as far as I know).
Thus I think it is unwise to bundle it in with the RGMII signals as you can only request a given pin once.
Adding it to the RGMIIResource for each PHY will result in only being able to use one of them at a time.
I agree with @TechnoMancer that MDIO poses a problem if it is shared, however the current resource definition system is already extremely prone to this problem and solutions for it will require more of the redesign and rethink on how potentially shared resources are requested. In the meantime I think that defining a separate MDIOResource would be better than only being able to use a single PHY at a time (this would not actually happen as the resource system does not check for underlying pin conflicts, only top-level Resource conflicts, but such an interface would be unsafe and unwise to expose, which is almost certainly worse).
For future designs we should think about how we might want to indicate that one resource is tangentially related to another (say, this MDIO applies to these PHYs), mostly for a sort of documentary function.