LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: <andrew@lunn.ch>, <f.fainelli@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: phy: DP83811: Add support for the phy
Date: Tue, 8 May 2018 10:56:55 -0500	[thread overview]
Message-ID: <1b6877db-61cf-101a-054e-9c1fbe95a813@ti.com> (raw)
In-Reply-To: <20180508141105.23867-1-dmurphy@ti.com>

All

On 05/08/2018 09:11 AM, Dan Murphy wrote:
> Add support for the DP83811 phy by extending
> the DP83822 driver to recognize the PHY IDs.
> 
> The DP83811 supports both rgmii and sgmii interfaces.
> There are 2 part numbers for this the DP83811R does not
> reliably support the SGMII interface but the DP83811S will.
> 
> There is not a way to differentiate these parts from the
> hardware or register set.  So this is controlled via the DT
> to indicate which phy mode is required.  Or the part can be
> strapped to a certain interface.
> 
> Data sheet can be found here:
> http://www.ti.com/product/DP83TC811S-Q1/description
> http://www.ti.com/product/DP83TC811R-Q1/description
> 

I am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811
and DP83822

> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/net/phy/dp83822.c | 42 ++++++++++++++++++++++++++++++++++++---
>  1 file changed, 39 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index 6e8a2a4f3a6e..5c379ff25dac 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -23,8 +23,10 @@
>  #include <linux/netdevice.h>
>  
>  #define DP83822_PHY_ID	        0x2000a240
> +#define DP83811_PHY_ID		0x2000a253
>  #define DP83822_DEVADDR		0x1f
>  
> +#define MII_DP83811_SGMII_CTRL	0x09
>  #define MII_DP83822_PHYSCR	0x11
>  #define MII_DP83822_MISR1	0x12
>  #define MII_DP83822_MISR2	0x13
> @@ -79,6 +81,13 @@
>  #define DP83822_WOL_INDICATION_SEL BIT(8)
>  #define DP83822_WOL_CLR_INDICATION BIT(11)
>  
> +/* DP83811 SGMII CTRL bits */
> +#define DP83811_TDR_AUTO		BIT(8)
> +#define DP83811_SGMII_EN		BIT(12)
> +#define DP83811_SGMII_AUTO_NEG_EN	BIT(13)
> +#define DP83811_SGMII_TX_ERR_DIS	BIT(14)
> +#define DP83811_SGMII_SOFT_RESET	BIT(15)
> +
>  static int dp83822_ack_interrupt(struct phy_device *phydev)
>  {
>  	int err;
> @@ -267,6 +276,17 @@ static int dp83822_config_init(struct phy_device *phydev)
>  	if (err < 0)
>  		return err;
>  
> +	if ((phydev->interface == PHY_INTERFACE_MODE_SGMII &&
> +	     phydev->phy_id == DP83811_PHY_ID)) {
> +		value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
> +		if (!(value & DP83811_SGMII_EN)) {
> +			err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
> +					(DP83811_SGMII_EN | value));
> +			if (err < 0)
> +				return err;
> +		}
> +	}
> +
>  	value = DP83822_WOL_MAGIC_EN | DP83822_WOL_SECURE_ON | DP83822_WOL_EN;
>  
>  	return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
> @@ -328,15 +348,31 @@ static struct phy_driver dp83822_driver[] = {
>  		.suspend = dp83822_suspend,
>  		.resume = dp83822_resume,
>  	 },
> +	{
> +		.phy_id = DP83811_PHY_ID,
> +		.phy_id_mask = 0xfffffff0,
> +		.name = "TI DP83811",
> +		.features = PHY_BASIC_FEATURES,
> +		.flags = PHY_HAS_INTERRUPT,
> +		.config_init = genphy_config_init,
> +		.soft_reset = dp83822_phy_reset,
> +		.get_wol = dp83822_get_wol,
> +		.set_wol = dp83822_set_wol,
> +		.ack_interrupt = dp83822_ack_interrupt,
> +		.config_intr = dp83822_config_intr,
> +		.suspend = dp83822_suspend,
> +		.resume = dp83822_resume,
> +	 },
>  };
>  module_phy_driver(dp83822_driver);
>  
>  static struct mdio_device_id __maybe_unused dp83822_tbl[] = {
> -	{ DP83822_PHY_ID, 0xfffffff0 },
> -	{ },
> +	{DP83822_PHY_ID, 0xfffffff0},
> +	{DP83811_PHY_ID, 0xfffffff0},
> +	{}
>  };
>  MODULE_DEVICE_TABLE(mdio, dp83822_tbl);
>  
> -MODULE_DESCRIPTION("Texas Instruments DP83822 PHY driver");
> +MODULE_DESCRIPTION("Texas Instruments DP83811/22 PHY driver");
>  MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com");
>  MODULE_LICENSE("GPL");
> 


-- 
------------------
Dan Murphy

  reply	other threads:[~2018-05-08 15:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 14:11 Dan Murphy
2018-05-08 15:56 ` Dan Murphy [this message]
2018-05-08 16:49   ` Andrew Lunn
2018-05-08 17:13     ` Dan Murphy
2018-05-08 17:14       ` Florian Fainelli
2018-05-08 17:21         ` Dan Murphy

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=1b6877db-61cf-101a-054e-9c1fbe95a813@ti.com \
    --to=dmurphy@ti.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH] net: phy: DP83811: Add support for the 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).