Patchwork phy/marvell: Add special settings for D-Link DNS-323 rev C1

login
register
mail settings
Submitter Benjamin Herrenschmidt
Date May 17, 2010, 12:27 a.m.
Message ID <1274056058.21352.697.camel@pasglop>
Download mbox | patch
Permalink /patch/52750/
State Superseded
Delegated to: David Miller
Headers show

Comments

Benjamin Herrenschmidt - May 17, 2010, 12:27 a.m.
Without this change, the network LED doesn't work on the device. The
value itself comes from the vendor kernel.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/net/phy/marvell.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)



--
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
Wolfram Sang - May 17, 2010, 12:59 a.m.
On Mon, May 17, 2010 at 10:27:38AM +1000, Benjamin Herrenschmidt wrote:
> Without this change, the network LED doesn't work on the device. The
> value itself comes from the vendor kernel.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  drivers/net/phy/marvell.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index 64c7fbe..22b1efa 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -34,6 +34,10 @@
>  #include <asm/irq.h>
>  #include <asm/uaccess.h>
>  
> +#ifdef CONFIG_ARM
> +#include <asm/mach-types.h>
> +#endif
> +
>  #define MII_M1011_IEVENT		0x13
>  #define MII_M1011_IEVENT_CLEAR		0x0000
>  
> @@ -350,7 +354,14 @@ static int m88e1118_config_init(struct phy_device *phydev)
>  		return err;
>  
>  	/* Adjust LED Control */
> +#ifdef CONFIG_MACH_DNS323
> +	/* The DNS-323 needs a special value in here for the LED to work */
> +	if (machine_is_dns323())
> +		err = phy_write(phydev, 0x10, 0x1100);
> +	else
> +#else
>  	err = phy_write(phydev, 0x10, 0x021e);
> +#endif

There is a fixup()-callback to prevent boardcode in the drivers. See
Documentation/networking/phy.txt, last chapter.
Benjamin Herrenschmidt - May 17, 2010, 1:07 a.m.
On Mon, 2010-05-17 at 02:59 +0200, Wolfram Sang wrote:
> There is a fixup()-callback to prevent boardcode in the drivers. See
> Documentation/networking/phy.txt, last chapter.

Ah nice ! I missed that bit. I'll add a fixup and see if it works.

The problem is that writing to this register seems to be part of a
specific initialization sequence, which is done one way in the linux
driver and differently in the vendor kernel. I don't know whether
I can just 'override' the value and I have no docs for that part.

But I'll definitely give it a go tonight.

Cheers,
Ben.


--
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

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 64c7fbe..22b1efa 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -34,6 +34,10 @@ 
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 
+#ifdef CONFIG_ARM
+#include <asm/mach-types.h>
+#endif
+
 #define MII_M1011_IEVENT		0x13
 #define MII_M1011_IEVENT_CLEAR		0x0000
 
@@ -350,7 +354,14 @@  static int m88e1118_config_init(struct phy_device *phydev)
 		return err;
 
 	/* Adjust LED Control */
+#ifdef CONFIG_MACH_DNS323
+	/* The DNS-323 needs a special value in here for the LED to work */
+	if (machine_is_dns323())
+		err = phy_write(phydev, 0x10, 0x1100);
+	else
+#else
 	err = phy_write(phydev, 0x10, 0x021e);
+#endif
 	if (err < 0)
 		return err;