[PATCH 1/2] Revert "net/ucc_geth: Add SGMII support for UEC GETH driver"

2009-06-17 Thread Grant Likely
From: Grant Likely 

This reverts commit 047584ce94108012288554a5f84585d792cc7f8f.

This patch meshes badly with "net: Rework ucc_geth driver to use
of_mdio infrastructure" (0b9da337dca972e7a4144e298ec3adb8f244d4a4).
Since most of the patch needs to be reworked, it is clearer to revert
the patch and then apply the corrected version

Signed-off-by: Grant Likely 
---

 arch/powerpc/include/asm/qe.h |2 -
 drivers/net/ucc_geth.c|   79 +
 drivers/net/ucc_geth.h|   28 +--
 3 files changed, 2 insertions(+), 107 deletions(-)


diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 157c5ca..e0faf33 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -675,8 +675,6 @@ struct ucc_slow_pram {
 #define UCC_GETH_UPSMR_RMM  0x1000
 #define UCC_GETH_UPSMR_CAM  0x0400
 #define UCC_GETH_UPSMR_BRO  0x0200
-#define UCC_GETH_UPSMR_SMM 0x0080
-#define UCC_GETH_UPSMR_SGMM0x0020
 
 /* UCC Transmit On Demand Register (UTODR) */
 #define UCC_SLOW_TOD   0x8000
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e2f2e91..5118993 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2009 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
  *
  * Author: Shlomi Gridish 
  *Li Yang 
@@ -65,8 +65,6 @@
 
 static DEFINE_SPINLOCK(ugeth_lock);
 
-static void uec_configure_serdes(struct net_device *dev);
-
 static struct {
u32 msg_enable;
 } debug = { -1 };
@@ -1412,9 +1410,6 @@ static int adjust_enet_interface(struct ucc_geth_private 
*ugeth)
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
upsmr |= UCC_GETH_UPSMR_TBIM;
}
-   if ((ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII))
-   upsmr |= UCC_GETH_UPSMR_SGMM;
-
out_be32(&uf_regs->upsmr, upsmr);
 
/* Disable autonegotiation in tbi mode, because by default it
@@ -1559,9 +1554,6 @@ static int init_phy(struct net_device *dev)
return -ENODEV;
}
 
-   if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII)
-   uec_configure_serdes(dev);
-
phydev->supported &= (ADVERTISED_10baseT_Half |
 ADVERTISED_10baseT_Full |
 ADVERTISED_100baseT_Half |
@@ -1577,41 +1569,7 @@ static int init_phy(struct net_device *dev)
return 0;
 }
 
-/* Initialize TBI PHY interface for communicating with the
- * SERDES lynx PHY on the chip.  We communicate with this PHY
- * through the MDIO bus on each controller, treating it as a
- * "normal" PHY at the address found in the UTBIPA register.  We assume
- * that the UTBIPA register is valid.  Either the MDIO bus code will set
- * it to a value that doesn't conflict with other PHYs on the bus, or the
- * value doesn't matter, as there are no other PHYs on the bus.
- */
-static void uec_configure_serdes(struct net_device *dev)
-{
-   struct ucc_geth_private *ugeth = netdev_priv(dev);
-
-   if (!ugeth->tbiphy) {
-   printk(KERN_WARNING "SGMII mode requires that the device "
-   "tree specify a tbi-handle\n");
-   return;
-   }
-
-   /*
-* If the link is already up, we must already be ok, and don't need to
-* configure and reset the TBI<->SerDes link.  Maybe U-Boot configured
-* everything for us?  Resetting it takes the link down and requires
-* several seconds for it to come back.
-*/
-   if (phy_read(ugeth->tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS)
-   return;
-
-   /* Single clk mode, mii mode off(for serdes communication) */
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS);
 
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT);
-
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS);
-
-}
 
 static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
 {
@@ -3573,8 +3531,6 @@ static phy_interface_t to_phy_interface(const char 
*phy_connection_type)
return PHY_INTERFACE_MODE_RGMII_RXID;
if (strcasecmp(phy_connection_type, "rtbi") == 0)
return PHY_INTERFACE_MODE_RTBI;
-   if (strcasecmp(phy_connection_type, "sgmii") == 0)
-   return PHY_INTERFACE_MODE_SGMII;
 
return PHY_INTERFACE_MODE_MII;
 }
@@ -3619,7 +3575,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_TBI, PHY_INTERFACE_MODE_RTBI,
-   PHY_INTERFACE_MODE_SGMII,
};
 
ugeth_vdbg("%s: IN", __func__);
@@ -3735,7 +3690,6 @@ static int ucc_geth_probe(struct

[PATCH 1/2] Revert "net/ucc_geth: Add SGMII support for UEC GETH driver"

2009-06-17 Thread Grant Likely
From: Grant Likely 

This reverts commit 047584ce94108012288554a5f84585d792cc7f8f.

This patch meshes badly with "net: Rework ucc_geth driver to use
of_mdio infrastructure" (0b9da337dca972e7a4144e298ec3adb8f244d4a4).
Since most of the patch needs to be reworked, it is clearer to revert
the patch and then apply the corrected version

Signed-off-by: Grant Likely 
---

 arch/powerpc/include/asm/qe.h |2 -
 drivers/net/ucc_geth.c|   79 +
 drivers/net/ucc_geth.h|   28 +--
 3 files changed, 2 insertions(+), 107 deletions(-)


diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 157c5ca..e0faf33 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -675,8 +675,6 @@ struct ucc_slow_pram {
 #define UCC_GETH_UPSMR_RMM  0x1000
 #define UCC_GETH_UPSMR_CAM  0x0400
 #define UCC_GETH_UPSMR_BRO  0x0200
-#define UCC_GETH_UPSMR_SMM 0x0080
-#define UCC_GETH_UPSMR_SGMM0x0020
 
 /* UCC Transmit On Demand Register (UTODR) */
 #define UCC_SLOW_TOD   0x8000
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e2f2e91..5118993 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2009 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
  *
  * Author: Shlomi Gridish 
  *Li Yang 
@@ -65,8 +65,6 @@
 
 static DEFINE_SPINLOCK(ugeth_lock);
 
-static void uec_configure_serdes(struct net_device *dev);
-
 static struct {
u32 msg_enable;
 } debug = { -1 };
@@ -1412,9 +1410,6 @@ static int adjust_enet_interface(struct ucc_geth_private 
*ugeth)
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
upsmr |= UCC_GETH_UPSMR_TBIM;
}
-   if ((ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII))
-   upsmr |= UCC_GETH_UPSMR_SGMM;
-
out_be32(&uf_regs->upsmr, upsmr);
 
/* Disable autonegotiation in tbi mode, because by default it
@@ -1559,9 +1554,6 @@ static int init_phy(struct net_device *dev)
return -ENODEV;
}
 
-   if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII)
-   uec_configure_serdes(dev);
-
phydev->supported &= (ADVERTISED_10baseT_Half |
 ADVERTISED_10baseT_Full |
 ADVERTISED_100baseT_Half |
@@ -1577,41 +1569,7 @@ static int init_phy(struct net_device *dev)
return 0;
 }
 
-/* Initialize TBI PHY interface for communicating with the
- * SERDES lynx PHY on the chip.  We communicate with this PHY
- * through the MDIO bus on each controller, treating it as a
- * "normal" PHY at the address found in the UTBIPA register.  We assume
- * that the UTBIPA register is valid.  Either the MDIO bus code will set
- * it to a value that doesn't conflict with other PHYs on the bus, or the
- * value doesn't matter, as there are no other PHYs on the bus.
- */
-static void uec_configure_serdes(struct net_device *dev)
-{
-   struct ucc_geth_private *ugeth = netdev_priv(dev);
-
-   if (!ugeth->tbiphy) {
-   printk(KERN_WARNING "SGMII mode requires that the device "
-   "tree specify a tbi-handle\n");
-   return;
-   }
-
-   /*
-* If the link is already up, we must already be ok, and don't need to
-* configure and reset the TBI<->SerDes link.  Maybe U-Boot configured
-* everything for us?  Resetting it takes the link down and requires
-* several seconds for it to come back.
-*/
-   if (phy_read(ugeth->tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS)
-   return;
-
-   /* Single clk mode, mii mode off(for serdes communication) */
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS);
 
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT);
-
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS);
-
-}
 
 static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
 {
@@ -3573,8 +3531,6 @@ static phy_interface_t to_phy_interface(const char 
*phy_connection_type)
return PHY_INTERFACE_MODE_RGMII_RXID;
if (strcasecmp(phy_connection_type, "rtbi") == 0)
return PHY_INTERFACE_MODE_RTBI;
-   if (strcasecmp(phy_connection_type, "sgmii") == 0)
-   return PHY_INTERFACE_MODE_SGMII;
 
return PHY_INTERFACE_MODE_MII;
 }
@@ -3619,7 +3575,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_TBI, PHY_INTERFACE_MODE_RTBI,
-   PHY_INTERFACE_MODE_SGMII,
};
 
ugeth_vdbg("%s: IN", __func__);
@@ -3735,7 +3690,6 @@ static int ucc_geth_probe(struct

[PATCH 1/2] Revert "net/ucc_geth: Add SGMII support for UEC GETH driver"

2009-06-17 Thread Grant Likely
From: Grant Likely 

This reverts commit 047584ce94108012288554a5f84585d792cc7f8f.

This patch meshes badly with "net: Rework ucc_geth driver to use
of_mdio infrastructure" (0b9da337dca972e7a4144e298ec3adb8f244d4a4).
Since most of the patch needs to be reworked, it is clearer to revert
the patch and then apply the corrected version

Signed-off-by: Grant Likely 
---

 arch/powerpc/include/asm/qe.h |2 -
 drivers/net/ucc_geth.c|   79 +
 drivers/net/ucc_geth.h|   28 +--
 3 files changed, 2 insertions(+), 107 deletions(-)


diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 157c5ca..e0faf33 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -675,8 +675,6 @@ struct ucc_slow_pram {
 #define UCC_GETH_UPSMR_RMM  0x1000
 #define UCC_GETH_UPSMR_CAM  0x0400
 #define UCC_GETH_UPSMR_BRO  0x0200
-#define UCC_GETH_UPSMR_SMM 0x0080
-#define UCC_GETH_UPSMR_SGMM0x0020
 
 /* UCC Transmit On Demand Register (UTODR) */
 #define UCC_SLOW_TOD   0x8000
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e2f2e91..5118993 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2009 Freescale Semicondutor, Inc. All rights reserved.
+ * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
  *
  * Author: Shlomi Gridish 
  *Li Yang 
@@ -65,8 +65,6 @@
 
 static DEFINE_SPINLOCK(ugeth_lock);
 
-static void uec_configure_serdes(struct net_device *dev);
-
 static struct {
u32 msg_enable;
 } debug = { -1 };
@@ -1412,9 +1410,6 @@ static int adjust_enet_interface(struct ucc_geth_private 
*ugeth)
(ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
upsmr |= UCC_GETH_UPSMR_TBIM;
}
-   if ((ugeth->phy_interface == PHY_INTERFACE_MODE_SGMII))
-   upsmr |= UCC_GETH_UPSMR_SGMM;
-
out_be32(&uf_regs->upsmr, upsmr);
 
/* Disable autonegotiation in tbi mode, because by default it
@@ -1559,9 +1554,6 @@ static int init_phy(struct net_device *dev)
return -ENODEV;
}
 
-   if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII)
-   uec_configure_serdes(dev);
-
phydev->supported &= (ADVERTISED_10baseT_Half |
 ADVERTISED_10baseT_Full |
 ADVERTISED_100baseT_Half |
@@ -1577,41 +1569,7 @@ static int init_phy(struct net_device *dev)
return 0;
 }
 
-/* Initialize TBI PHY interface for communicating with the
- * SERDES lynx PHY on the chip.  We communicate with this PHY
- * through the MDIO bus on each controller, treating it as a
- * "normal" PHY at the address found in the UTBIPA register.  We assume
- * that the UTBIPA register is valid.  Either the MDIO bus code will set
- * it to a value that doesn't conflict with other PHYs on the bus, or the
- * value doesn't matter, as there are no other PHYs on the bus.
- */
-static void uec_configure_serdes(struct net_device *dev)
-{
-   struct ucc_geth_private *ugeth = netdev_priv(dev);
-
-   if (!ugeth->tbiphy) {
-   printk(KERN_WARNING "SGMII mode requires that the device "
-   "tree specify a tbi-handle\n");
-   return;
-   }
-
-   /*
-* If the link is already up, we must already be ok, and don't need to
-* configure and reset the TBI<->SerDes link.  Maybe U-Boot configured
-* everything for us?  Resetting it takes the link down and requires
-* several seconds for it to come back.
-*/
-   if (phy_read(ugeth->tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS)
-   return;
-
-   /* Single clk mode, mii mode off(for serdes communication) */
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS);
 
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT);
-
-   phy_write(ugeth->tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS);
-
-}
 
 static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
 {
@@ -3573,8 +3531,6 @@ static phy_interface_t to_phy_interface(const char 
*phy_connection_type)
return PHY_INTERFACE_MODE_RGMII_RXID;
if (strcasecmp(phy_connection_type, "rtbi") == 0)
return PHY_INTERFACE_MODE_RTBI;
-   if (strcasecmp(phy_connection_type, "sgmii") == 0)
-   return PHY_INTERFACE_MODE_SGMII;
 
return PHY_INTERFACE_MODE_MII;
 }
@@ -3619,7 +3575,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_RGMII,
PHY_INTERFACE_MODE_TBI, PHY_INTERFACE_MODE_RTBI,
-   PHY_INTERFACE_MODE_SGMII,
};
 
ugeth_vdbg("%s: IN", __func__);
@@ -3735,7 +3690,6 @@ static int ucc_geth_probe(struct