ar71xx: update mdio_reset code
[openwrt-10.03/.git] / target / linux / ar71xx / files / drivers / net / ag71xx / ag71xx_mdio.c
index 57212788950cff83587b50824fdc55c60ad70e3a..d3cbacedb26596c96a81b0f649fb7018b7d3ab9e 100644 (file)
@@ -21,7 +21,13 @@ struct ag71xx_mdio *ag71xx_mdio_bus;
 static inline void ag71xx_mdio_wr(struct ag71xx_mdio *am, unsigned reg,
                                  u32 value)
 {
-       __raw_writel(value, am->mdio_base + reg);
+       void __iomem *r;
+
+       r = am->mdio_base + reg;
+       __raw_writel(value, r);
+
+       /* flush write */
+       (void) __raw_readl(r);
 }
 
 static inline u32 ag71xx_mdio_rr(struct ag71xx_mdio *am, unsigned reg)
@@ -98,11 +104,14 @@ static void ag71xx_mdio_mii_write(struct ag71xx_mdio *am,
 static int ag71xx_mdio_reset(struct mii_bus *bus)
 {
        struct ag71xx_mdio *am = bus->priv;
+       u32 t;
+
+       t = MII_CFG_CLK_DIV_28;
 
-       ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, MII_CFG_RESET);
+       ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t | MII_CFG_RESET);
        udelay(100);
 
-       ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, MII_CFG_CLK_DIV_28);
+       ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t);
        udelay(100);
 
        return 0;