From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Date: Wed, 4 May 2022 14:48:22 +0200 [thread overview]
Message-ID: <YnJ2Fvux5ZE9zqyT@lunn.ch> (raw)
In-Reply-To: <20220504110655.1470008-3-o.rempel@pengutronix.de>
On Wed, May 04, 2022 at 01:06:55PM +0200, Oleksij Rempel wrote:
> The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
> that supports 10M single pair cable.
>
> This driver was tested with NXP SJA1105, STMMAC and ASIX AX88772B USB Ethernet
> controller.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thanks for the re-write. This looks a lot better.
> + ret = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_T1_ADV_L);
> + if (ret < 0)
> + return ret;
> +
> + cfg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_T1_ADV_M);
> + if (cfg < 0)
> + return cfg;
> +
> + if (ret & MDIO_AN_T1_ADV_L_FORCE_MS) {
> + if (cfg & MDIO_AN_T1_ADV_M_MST)
> + phydev->master_slave_get =
> + MASTER_SLAVE_CFG_MASTER_FORCE;
> + else
> + phydev->master_slave_get =
> + MASTER_SLAVE_CFG_SLAVE_FORCE;
> + } else {
> + if (cfg & MDIO_AN_T1_ADV_M_MST)
> + phydev->master_slave_get =
> + MASTER_SLAVE_CFG_MASTER_PREFERRED;
> + else
> + phydev->master_slave_get =
> + MASTER_SLAVE_CFG_SLAVE_PREFERRED;
> + }
Is this identical to genphy_c45_baset1_read_status()? I don't think
there are any odd vendor registers here. So i suggest exporting it and
making use of it.
> +static int dp83td510_config_master_slave(struct phy_device *phydev)
> +{
> + int ctl = 0;
> +
> + switch (phydev->master_slave_set) {
> + case MASTER_SLAVE_CFG_MASTER_PREFERRED:
> + case MASTER_SLAVE_CFG_MASTER_FORCE:
> + ctl = MDIO_PMA_PMD_BT1_CTRL_CFG_MST;
> + break;
> + case MASTER_SLAVE_CFG_SLAVE_FORCE:
> + case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
> + break;
> + case MASTER_SLAVE_CFG_UNKNOWN:
> + case MASTER_SLAVE_CFG_UNSUPPORTED:
> + return 0;
> + default:
> + phydev_warn(phydev, "Unsupported Master/Slave mode\n");
> + return -EOPNOTSUPP;
> + }
> +
> + return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
> + MDIO_PMA_PMD_BT1_CTRL_CFG_MST, ctl);
Is this identical to what is in genphy_c45_pma_setup_forced()? If so,
i would pull that code out into a helper and make use of it.
Thanks
Andrew
prev parent reply other threads:[~2022-05-04 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 11:06 [PATCH net-next v2 0/2] add ti dp83td510 support Oleksij Rempel
2022-05-04 11:06 ` [PATCH net-next v2 1/2] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration Oleksij Rempel
2022-05-04 12:27 ` Andrew Lunn
2022-05-04 12:40 ` Oleksij Rempel
2022-05-04 11:06 ` [PATCH net-next v2 2/2] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY Oleksij Rempel
2022-05-04 12:48 ` Andrew Lunn [this message]
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=YnJ2Fvux5ZE9zqyT@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).