diff mbox

[net,v3,2/3] libphy: Add stubs to hook IEEE MMD Register reads and writes

Message ID 1403482910-20821-3-git-send-email-vbridgers2013@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Vince Bridgers June 23, 2014, 12:21 a.m. UTC
The Micrel ksz9021 PHY does not support standard IEEE standard MMD
extended register access, therefore requires stubs to fail the read
register method and do nothing for the write register method when
libphy attempts to read and/or configure Energy Efficient Ethernet
features in PHYS that do support those features. This problem
was observed on an Altera Cyclone V SOC development kit that
uses the Synopsys EMAC and the Micrel ksz9021 PHY. This patch
was tested on the same board, and Energy Efficient Ethernet is
now disabled as expected since the Micrel PHY does not support that
feature.

Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
---
V3: Remove unnecessary returns from void functions.
V2: Split libphy and Micrel specific changes into 2 patches
    based on review comments
---
 drivers/net/phy/micrel.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov June 23, 2014, 12:29 p.m. UTC | #1
Hello.

On 06/23/2014 04:21 AM, Vince Bridgers wrote:

> The Micrel ksz9021 PHY does not support standard IEEE standard MMD
> extended register access, therefore requires stubs to fail the read
> register method and do nothing for the write register method when
> libphy attempts to read and/or configure Energy Efficient Ethernet
> features in PHYS that do support those features. This problem
> was observed on an Altera Cyclone V SOC development kit that
> uses the Synopsys EMAC and the Micrel ksz9021 PHY. This patch
> was tested on the same board, and Energy Efficient Ethernet is
> now disabled as expected since the Micrel PHY does not support that
> feature.

> Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
> ---
> V3: Remove unnecessary returns from void functions.
> V2: Split libphy and Micrel specific changes into 2 patches
>      based on review comments
> ---
>   drivers/net/phy/micrel.c |   23 ++++++++++++++++++++++-
>   1 file changed, 22 insertions(+), 1 deletion(-)

> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index bc7c7d2..daf8bab 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -417,7 +417,26 @@ static int ksz8873mll_read_status(struct phy_device *phydev)
>
>   static int ksz8873mll_config_aneg(struct phy_device *phydev)
>   {
> -	return 0;

    Eh? The function returns *int* and you're removing the only *return* 
statement?

> +}

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vince Bridgers June 28, 2014, 7:47 p.m. UTC | #2
On Mon, Jun 23, 2014 at 7:29 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
>
> On 06/23/2014 04:21 AM, Vince Bridgers wrote:
>
>> The Micrel ksz9021 PHY does not support standard IEEE standard MMD
>> extended register access, therefore requires stubs to fail the read
>> register method and do nothing for the write register method when
>> libphy attempts to read and/or configure Energy Efficient Ethernet
>> features in PHYS that do support those features. This problem
>> was observed on an Altera Cyclone V SOC development kit that
>> uses the Synopsys EMAC and the Micrel ksz9021 PHY. This patch
>> was tested on the same board, and Energy Efficient Ethernet is
>> now disabled as expected since the Micrel PHY does not support that
>> feature.
>
>
>> Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
>> ---
>> V3: Remove unnecessary returns from void functions.
>> V2: Split libphy and Micrel specific changes into 2 patches
>>      based on review comments
>> ---
>>   drivers/net/phy/micrel.c |   23 ++++++++++++++++++++++-
>>   1 file changed, 22 insertions(+), 1 deletion(-)
>
>
>> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
>> index bc7c7d2..daf8bab 100644
>> --- a/drivers/net/phy/micrel.c
>> +++ b/drivers/net/phy/micrel.c
>> @@ -417,7 +417,26 @@ static int ksz8873mll_read_status(struct phy_device
>> *phydev)
>>
>>   static int ksz8873mll_config_aneg(struct phy_device *phydev)
>>   {
>> -       return 0;
>
>
>    Eh? The function returns *int* and you're removing the only *return*
> statement?

Oops, thanks for catching this. I'll address and respin.

>
>> +}
>
>
> WBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index bc7c7d2..daf8bab 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -417,7 +417,26 @@  static int ksz8873mll_read_status(struct phy_device *phydev)
 
 static int ksz8873mll_config_aneg(struct phy_device *phydev)
 {
-	return 0;
+}
+
+/* This routine returns -1 as an indication to the caller that the
+ * Micrel ksz9021 10/100/1000 PHY does not support standard IEEE
+ * MMD extended PHY registers.
+ */
+static int
+ksz9021_rd_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum,
+		      int regnum)
+{
+	return -1;
+}
+
+/* This routine does nothing since the Micrel ksz9021 does not support
+ * standard IEEE MMD extended PHY registers.
+ */
+static void
+ksz9021_wr_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum,
+		      int regnum, u32 val)
+{
 }
 
 static struct phy_driver ksphy_driver[] = {
@@ -565,6 +584,8 @@  static struct phy_driver ksphy_driver[] = {
 	.config_intr	= ksz9021_config_intr,
 	.suspend	= genphy_suspend,
 	.resume		= genphy_resume,
+	.rd_mmd_indirect = ksz9021_rd_mmd_phyreg,
+	.wr_mmd_indirect = ksz9021_wr_mmd_phyreg,
 	.driver		= { .owner = THIS_MODULE, },
 }, {
 	.phy_id		= PHY_ID_KSZ9031,