Re: [PATCH v4 08/14] net: phy: adin: add support MDI/MDIX/Auto-MDI selection

From: Florian Fainelli
Date: Wed Aug 14 2019 - 13:54:30 EST




On 8/12/2019 4:23 AM, Alexandru Ardelean wrote:
> The ADIN PHYs support automatic MDI/MDIX negotiation. By default this is
> disabled, so this is enabled at `config_init`.
>
> This is controlled via the PHY Control 1 register.
> The supported modes are:
> 1. Manual MDI
> 2. Manual MDIX
> 3. Auto MDIX - prefer MDIX
> 4. Auto MDIX - prefer MDI
>
> The phydev mdix & mdix_ctrl fields include modes 3 & 4 into a single
> auto-mode. So, the default mode this driver enables is 4 when Auto-MDI mode
> is used.
>
> When detecting MDI/MDIX mode, a combination of the PHY Control 1 register
> and PHY Status 1 register is used to determine the correct MDI/MDIX mode.
>
> If Auto-MDI mode is not set, then the manual MDI/MDIX mode is returned.
> If Auto-MDI mode is set, then MDIX mode is returned differs from the
> preferred MDI/MDIX mode.
> This covers all cases where:
> 1. MDI preferred & Pair01Swapped == MDIX
> 2. MDIX preferred & Pair01Swapped == MDI
> 3. MDI preferred & ! Pair01Swapped == MDIX
> 4. MDIX preferred & ! Pair01Swapped == MDI
>
> The preferred MDI/MDIX mode is not configured via SW, but can be configured
> via HW pins. Note that the `Pair01Swapped` is the Green-Yellow physical
> pairs.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>

Reviewed-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
--
Florian