netxen: improve pci memory access
[safe/jmp/linux-2.6] / drivers / net / ibm_newemac / rgmii.c
index e32da3d..8d76cb8 100644 (file)
@@ -39,6 +39,7 @@
 #define RGMII_FER_RGMII(idx)   (0x5 << ((idx) * 4))
 #define RGMII_FER_TBI(idx)     (0x6 << ((idx) * 4))
 #define RGMII_FER_GMII(idx)    (0x7 << ((idx) * 4))
+#define RGMII_FER_MII(idx)     RGMII_FER_GMII(idx)
 
 /* RGMIIx_SSR */
 #define RGMII_SSR_MASK(idx)    (0x7 << ((idx) * 8))
@@ -49,6 +50,7 @@
 static inline int rgmii_valid_mode(int phy_mode)
 {
        return  phy_mode == PHY_MODE_GMII ||
+               phy_mode == PHY_MODE_MII ||
                phy_mode == PHY_MODE_RGMII ||
                phy_mode == PHY_MODE_TBI ||
                phy_mode == PHY_MODE_RTBI;
@@ -63,6 +65,8 @@ static inline const char *rgmii_mode_name(int mode)
                return "TBI";
        case PHY_MODE_GMII:
                return "GMII";
+       case PHY_MODE_MII:
+               return "MII";
        case PHY_MODE_RTBI:
                return "RTBI";
        default:
@@ -79,6 +83,8 @@ static inline u32 rgmii_mode_mask(int mode, int input)
                return RGMII_FER_TBI(input);
        case PHY_MODE_GMII:
                return RGMII_FER_GMII(input);
+       case PHY_MODE_MII:
+               return RGMII_FER_MII(input);
        case PHY_MODE_RTBI:
                return RGMII_FER_RTBI(input);
        default:
@@ -182,11 +188,12 @@ void rgmii_put_mdio(struct of_device *ofdev, int input)
 void rgmii_detach(struct of_device *ofdev, int input)
 {
        struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
-       struct rgmii_regs __iomem *p = dev->base;
-
-       mutex_lock(&dev->lock);
+       struct rgmii_regs __iomem *p;
 
        BUG_ON(!dev || dev->users == 0);
+       p = dev->base;
+
+       mutex_lock(&dev->lock);
 
        RGMII_DBG(dev, "detach(%d)" NL, input);