netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm9161: add configuration for MII/RMII
@ 2008-01-11 18:28 frederic RODO
  0 siblings, 0 replies; 3+ messages in thread
From: frederic RODO @ 2008-01-11 18:28 UTC (permalink / raw)
  To: netdev

diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index 7ed632d..6bdc32f 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -37,6 +37,7 @@

  #define MII_DM9161_SCR		0x10
  #define MII_DM9161_SCR_INIT	0x0610
+#define MII_DM9161_SCR_RMII	0x0100

  /* DM9161 Interrupt Register */
  #define MII_DM9161_INTR	0x15
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev)

  static int dm9161_config_init(struct phy_device *phydev)
  {
-	int err;
+	int err, temp;

  	/* Isolate the PHY */
  	err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
@@ -111,8 +112,19 @@ static int dm9161_config_init(struct phy_device 
*phydev)
  	if (err < 0)
  		return err;

-	/* Do not bypass the scrambler/descrambler */
-	err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
+	/* Do not bypass the scrambler/descrambler , configure MII Mode */
+	switch (phydev->interface) {
+	case PHY_INTERFACE_MODE_MII:
+		temp = MII_DM9161_SCR_INIT;
+		break;
+	case PHY_INTERFACE_MODE_RMII:
+		temp =  MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	err = phy_write(phydev, MII_DM9161_SCR, temp);

  	if (err < 0)
  		return err;
Signed-off-by: Frederic RODO <f.rodo@til-technologies.fr>

-------------------------------------------------------------------------
Les informations précédentes peuvent être confidentielles ou privilégiées.
Si vous n'êtes pas le destinataire prévu de ce mail, veuillez en notifier 
l'expéditeur en répondant à ce message puis supprimez-en toute trace 
de vos systèmes.

TIL Technologies
Parc du Golf, Bat 43
350 rue J.R Guilibert Gautier de la Lauzière 
13856 AIX EN PROVENCE
Tel. : +33 4 42 37 11 77
-------------------------------------------------------------------------



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] dm9161: add configuration for MII/RMII
@ 2008-02-27 11:58 frederic Rodo
  2008-03-05 11:27 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: frederic Rodo @ 2008-02-27 11:58 UTC (permalink / raw)
  To: netdev; +Cc: jgarzik, avictor.za, afleming

Hi Jeff,

I've send this patch on netdev on January. It's add the MII/RMII configuration for davicom dm9161. Can you merge it into 
the mainline?

thanks

diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index 7ed632d..6bdc32f 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -37,6 +37,7 @@

  #define MII_DM9161_SCR        0x10
  #define MII_DM9161_SCR_INIT    0x0610
+#define MII_DM9161_SCR_RMII    0x0100

  /* DM9161 Interrupt Register */
  #define MII_DM9161_INTR    0x15
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev)

  static int dm9161_config_init(struct phy_device *phydev)
  {
-    int err;
+    int err, temp;

      /* Isolate the PHY */
      err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
@@ -111,8 +112,19 @@ static int dm9161_config_init(struct phy_device *phydev)
      if (err < 0)
          return err;

-    /* Do not bypass the scrambler/descrambler */
-    err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
+    /* Do not bypass the scrambler/descrambler , configure MII Mode */
+    switch (phydev->interface) {
+    case PHY_INTERFACE_MODE_MII:
+        temp = MII_DM9161_SCR_INIT;
+        break;
+    case PHY_INTERFACE_MODE_RMII:
+        temp =  MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII;
+        break;
+    default:
+        return -EINVAL;
+    }
+
+    err = phy_write(phydev, MII_DM9161_SCR, temp);

      if (err < 0)
          return err;
Signed-off-by: Frederic Rodo <f.rodo@til-technologies.fr>

-------------------------------------------------------------------------
Les informations précédentes peuvent être confidentielles ou privilégiées.
Si vous n'êtes pas le destinataire prévu de ce mail, veuillez en notifier 
l'expéditeur en répondant à ce message puis supprimez-en toute trace 
de vos systèmes.

TIL Technologies
Parc du Golf, Bat 43
350 rue J.R Guilibert Gautier de la Lauzière 
13856 AIX EN PROVENCE
Tel. : +33 4 42 37 11 77
-------------------------------------------------------------------------



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dm9161: add configuration for MII/RMII
  2008-02-27 11:58 [PATCH] dm9161: add configuration for MII/RMII frederic Rodo
@ 2008-03-05 11:27 ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2008-03-05 11:27 UTC (permalink / raw)
  To: frederic Rodo; +Cc: netdev, avictor.za, afleming

applied



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-05 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 11:58 [PATCH] dm9161: add configuration for MII/RMII frederic Rodo
2008-03-05 11:27 ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2008-01-11 18:28 frederic RODO

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