1 --- linux-2.4.30.old/drivers/net/b44.c 2005-05-01 23:30:22.000000000 +0400
2 +++ linux-2.4.30/drivers/net/b44.c 2005-05-10 16:51:24.410654488 +0400
4 bw32(B44_IMASK, bp->imask);
7 -static int b44_readphy(struct b44 *bp, int reg, u32 *val)
8 +static int __b44_readphy(struct b44 *bp, int phy_addr, int reg, u32 *val)
12 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
15 bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
16 bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
17 (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
18 - (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
19 + (phy_addr << MDIO_DATA_PMD_SHIFT) |
20 (reg << MDIO_DATA_RA_SHIFT) |
21 (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
22 err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
27 -static int b44_writephy(struct b44 *bp, int reg, u32 val)
28 +static int b44_readphy(struct b44 *bp, int reg, u32 *val)
30 if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
33 + return __b44_readphy(bp, bp->phy_addr, reg, val);
36 +static int __b44_writephy(struct b44 *bp, int phy_addr, int reg, u32 val)
38 bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
39 bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
40 (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
41 - (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
42 + (phy_addr << MDIO_DATA_PMD_SHIFT) |
43 (reg << MDIO_DATA_RA_SHIFT) |
44 (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) |
45 (val & MDIO_DATA_DATA)));
46 return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
49 +static int b44_writephy(struct b44 *bp, int reg, u32 val)
51 + if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
54 + return __b44_writephy(bp, bp->phy_addr, reg, val);
57 static int b44_phy_reset(struct b44 *bp)
63 spin_lock_irq(&bp->lock);
64 - err = b44_readphy(bp, data->reg_num & 0x1f, &mii_regval);
65 + err = __b44_readphy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, &mii_regval);
66 spin_unlock_irq(&bp->lock);
68 data->val_out = mii_regval;
72 spin_lock_irq(&bp->lock);
73 - err = b44_writephy(bp, data->reg_num & 0x1f, data->val_in);
74 + err = __b44_writephy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
75 spin_unlock_irq(&bp->lock);
78 @@ -1919,6 +1929,11 @@
79 printk("%2.2x%c", dev->dev_addr[i],
82 + /* Initialize phy */
83 + spin_lock_irq(&bp->lock);
85 + spin_unlock_irq(&bp->lock);