fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / fec_8xx / fec_mii.c
index 7002336..d3c16b8 100644 (file)
@@ -10,7 +10,6 @@
  * Released under the GPL
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/mii.h>
 #include <linux/ethtool.h>
+#include <linux/bitops.h>
 
 #include <asm/8xx_immap.h>
 #include <asm/pgtable.h>
 #include <asm/mpc8xx.h>
 #include <asm/irq.h>
-#include <asm/bitops.h>
 #include <asm/uaccess.h>
 #include <asm/commproc.h>
 
@@ -54,7 +53,7 @@
 /*************************************************/
 
 /* XXX both FECs use the MII interface of FEC1 */
-static spinlock_t fec_mii_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(fec_mii_lock);
 
 #define FEC_MII_LOOPS  10000
 
@@ -203,6 +202,39 @@ static void dm9161_shutdown(struct net_device *dev)
 
 #endif
 
+#ifdef CONFIG_FEC_8XX_LXT971_PHY
+
+/* Support for LXT971/972 PHY */
+
+#define MII_LXT971_PCR         16 /* Port Control Register */
+#define MII_LXT971_SR2         17 /* Status Register 2 */
+#define MII_LXT971_IER         18 /* Interrupt Enable Register */
+#define MII_LXT971_ISR         19 /* Interrupt Status Register */
+#define MII_LXT971_LCR         20 /* LED Control Register */
+#define MII_LXT971_TCR         30 /* Transmit Control Register */
+
+static void lxt971_startup(struct net_device *dev)
+{
+       struct fec_enet_private *fep = netdev_priv(dev);
+
+       fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x00F2);
+}
+
+static void lxt971_ack_int(struct net_device *dev)
+{
+       struct fec_enet_private *fep = netdev_priv(dev);
+
+       fec_mii_read(dev, fep->mii_if.phy_id, MII_LXT971_ISR);
+}
+
+static void lxt971_shutdown(struct net_device *dev)
+{
+       struct fec_enet_private *fep = netdev_priv(dev);
+
+       fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x0000);
+}
+#endif
+
 /**********************************************************************************/
 
 static const struct phy_info phy_info[] = {
@@ -215,6 +247,15 @@ static const struct phy_info phy_info[] = {
         .shutdown = dm9161_shutdown,
         },
 #endif
+#ifdef CONFIG_FEC_8XX_LXT971_PHY
+       {
+        .id = 0x0001378e,
+        .name = "LXT971/972",
+        .startup = lxt971_startup,
+        .ack_int = lxt971_ack_int,
+        .shutdown = lxt971_shutdown,
+       },
+#endif
 #ifdef CONFIG_FEC_8XX_GENERIC_PHY
        {
         .id = 0,