lkml.org 
[lkml]   [2021]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v1 5/9] net: phy: micrel: ksz886x add MDI-X support
> +/* Device specific MII_BMCR (Reg 0) bits */
> +/* 1 = HP Auto MDI/MDI-X mode, 0 = Microchip Auto MDI/MDI-X mode */
> +#define KSZ886X_BMCR_HP_MDIX BIT(5)
> +/* 1 = Force MDI (transmit on RXP/RXM pins), 0 = Normal operation
> + * (transmit on TXP/TXM pins)
> + */
> +#define KSZ886X_BMCR_FORCE_MDI BIT(4)
> +/* 1 = Disable auto MDI-X */
> +#define KSZ886X_BMCR_DISABLE_AUTO_MDIX BIT(3)
> +#define KSZ886X_BMCR_DISABLE_FAR_END_FAULT BIT(2)
> +#define KSZ886X_BMCR_DISABLE_TRANSMIT BIT(1)
> +#define KSZ886X_BMCR_DISABLE_LED BIT(0)

Do these have the same values as what you added in patch 1?

> +static int ksz886x_config_mdix(struct phy_device *phydev, u8 ctrl)
> +{
> + u16 val;
> +
> + switch (ctrl) {
> + case ETH_TP_MDI:
> + val = KSZ886X_BMCR_DISABLE_AUTO_MDIX;
> + break;
> + case ETH_TP_MDI_X:
> + /* Note: The naming of the bit KSZ886X_BMCR_FORCE_MDI is bit
> + * counter intuitive, the "-X" in "1 = Force MDI" in the data
> + * sheet seems to be missing:
> + * 1 = Force MDI (sic!) (transmit on RX+/RX- pins)
> + * 0 = Normal operation (transmit on TX+/TX- pins)
> + */
> + val = KSZ886X_BMCR_DISABLE_AUTO_MDIX | KSZ886X_BMCR_FORCE_MDI;
> + break;
> + case ETH_TP_MDI_AUTO:
> + val = 0;
> + break;
> + default:
> + return 0;
> + }
> +
> + return phy_modify(phydev, MII_BMCR,
> + KSZ886X_BMCR_HP_MDIX | KSZ886X_BMCR_FORCE_MDI |
> + KSZ886X_BMCR_DISABLE_AUTO_MDIX,
> + KSZ886X_BMCR_HP_MDIX | val);
> +}

Maybe this will also work for the PHY driver embedded in ksz8795.c?
Maybe as another patchset, see if that PHY driver can be moved out of the DSA driver,
and share some code with this driver?

Andrew

\
 
 \ /
  Last update: 2021-05-05 14:37    [W:0.086 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site