linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Dan Murphy <dmurphy@ti.com>,
	kernel@pengutronix.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, David Jander <david@protonic.nl>,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH net-next v1 1/1] net: phy: dp83td510: Add basic support for the DP83TD510 Ethernet PHY
Date: Fri, 23 Jul 2021 19:08:49 +0200	[thread overview]
Message-ID: <20210723170848.lh3l62l7spcyphly@pengutronix.de> (raw)
In-Reply-To: <YPrCiIz7baU26kLU@lunn.ch>

Hi Andrew,

On Fri, Jul 23, 2021 at 03:22:16PM +0200, Andrew Lunn wrote:
> On Fri, Jul 23, 2021 at 12:42:18PM +0200, Oleksij Rempel wrote:
> > The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
> > that supports 10M single pair cable.
> > 
> > This driver provides basic support for this chip:
> > - link status
> > - autoneg can be turned off
> > - master/slave can be configured to be able to work without autoneg
> > 
> > This driver and PHY was tested with ASIX AX88772B USB Ethernet controller.
> 
> Hi Oleksij
> 
> There were patches flying around recently for another T1L PHY which
> added new link modes. Please could you work together with that patch
> to set the phydev features correctly to indicate this PHY is also a
> T1L, and if it support 2.4v etc.

ACK, thx. I was not able to spend enough time to investigate all needed
caps, so I decided to go mainline with limited functionality first.

> > +static int dp83td510_config_aneg(struct phy_device *phydev)
> > +{
> > +	u16 ctrl = 0, pmd_ctrl = 0;
> > +	int ret;
> > +
> > +	switch (phydev->master_slave_set) {
> > +	case MASTER_SLAVE_CFG_MASTER_FORCE:
> > +		if (phydev->autoneg) {
> > +			phydev->master_slave_set = MASTER_SLAVE_CFG_UNSUPPORTED;
> > +			phydev_warn(phydev, "Can't force master mode if autoneg is enabled\n");
> > +			goto do_aneg;
> > +		}
> > +		pmd_ctrl |= DP83TD510_PMD_CTRL_MASTER_MODE;
> > +		break;
> > +	case MASTER_SLAVE_CFG_SLAVE_FORCE:
> > +		if (phydev->autoneg) {
> > +			phydev->master_slave_set = MASTER_SLAVE_CFG_UNSUPPORTED;
> > +			phydev_warn(phydev, "Can't force slave mode if autoneg is enabled\n");
> > +			goto do_aneg;
> > +		}
> > +		break;
> > +	case MASTER_SLAVE_CFG_MASTER_PREFERRED:
> > +	case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
> > +		phydev->master_slave_set = MASTER_SLAVE_CFG_UNSUPPORTED;
> > +		phydev_warn(phydev, "Preferred master/slave modes are not supported\n");
> > +		goto do_aneg;
> > +	case MASTER_SLAVE_CFG_UNKNOWN:
> > +	case MASTER_SLAVE_CFG_UNSUPPORTED:
> > +		goto do_aneg;
> > +	default:
> > +		phydev_warn(phydev, "Unsupported Master/Slave mode\n");
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	ret = dp83td510_modify(phydev, DP83TD510_PMA_PMD_CTRL,
> > +			       DP83TD510_PMD_CTRL_MASTER_MODE, pmd_ctrl);
> > +	if (ret)
> > +		return ret;
> > +
> > +do_aneg:
> > +	if (phydev->autoneg)
> > +		ctrl |= DP83TD510_AN_ENABLE;
> > +
> > +	ret = dp83td510_modify_changed(phydev, DP83TD510_AN_CONTROL,
> > +				       DP83TD510_AN_ENABLE, ctrl);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	/* Reset link if settings are changed */
> > +	if (ret)
> > +		ret = dp83td510_write(phydev, MII_BMCR, BMCR_RESET);
> > +
> > +	return ret;
> > +}
> > +
> > +static int dp83td510_strap(struct phy_device *phydev)
> > +{
> 
> > +	phydev_info(phydev,
> > +		    "bootstrap cfg: Pin 18: %s, Pin 30: %s, TX Vpp: %s, RX trap: %s, xMII mode: %s, PHY addr: 0x%x\n",
> > +		    pin18 ? "RX_DV" : "CRS_DV",
> > +		    pin30 ? "LED_1" : "CLKOUT",
> > +		    tx_vpp ? "1.0V p2p" : "2.4V & 1.0V p2p",
> > +		    rx_trap ? "< 40Ω" : "50Ω",
> > +		    dp83td510_get_xmii_mode_str(xmii_mode),
> > +		    addr);
> 
> What i learned reviewing the other T1L driver is that 2.4v operation
> seems to be something you negotiate. Yet i don't see anything about it
> in dp83td510_config_aneg() ?

voltage depends on the end application: cable length, safety requirements. I do
not see how this can be chosen only on auto negotiation. We would need proper
user space interface to let user/integrator set the limits.

May be IEEE 802.3cg (802.3-2019?) provides more information on how this should be
done. Do any one has access to it? I'll be happy to have it.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2021-07-23 17:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 10:42 Oleksij Rempel
2021-07-23 13:22 ` Andrew Lunn
2021-07-23 17:08   ` Oleksij Rempel [this message]
2021-07-23 18:12     ` Andrew Lunn
2021-07-26 12:18       ` Oleksij Rempel
2021-07-26 13:23         ` Andrew Lunn
2021-07-27  6:51           ` Oleksij Rempel
2021-07-24  0:56 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210723170848.lh3l62l7spcyphly@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=david@protonic.nl \
    --cc=dmurphy@ti.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH net-next v1 1/1] net: phy: dp83td510: Add basic support for the DP83TD510 Ethernet PHY' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).