Changeset 30837


Ignore:
Timestamp:
2012-03-07T17:32:30+01:00 (6 years ago)
Author:
juhosg
Message:

generic: ar8216: use bus->mdio_lock directly in ar8216_mii_{read,write}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/ar8216.c

    r30836 r30837  
    7878{ 
    7979        struct phy_device *phy = priv->phy; 
     80        struct mii_bus *bus = phy->bus; 
    8081        u16 r1, r2, page; 
    8182        u16 lo, hi; 
    8283 
    8384        split_addr((u32) reg, &r1, &r2, &page); 
    84         mdiobus_write(phy->bus, 0x18, 0, page); 
     85 
     86        mutex_lock(&bus->mdio_lock); 
     87 
     88        bus->write(bus, 0x18, 0, page); 
    8589        msleep(1); /* wait for the page switch to propagate */ 
    86         lo = mdiobus_read(phy->bus, 0x10 | r2, r1); 
    87         hi = mdiobus_read(phy->bus, 0x10 | r2, r1 + 1); 
     90        lo = bus->read(bus, 0x10 | r2, r1); 
     91        hi = bus->read(bus, 0x10 | r2, r1 + 1); 
     92 
     93        mutex_unlock(&bus->mdio_lock); 
    8894 
    8995        return (hi << 16) | lo; 
     
    94100{ 
    95101        struct phy_device *phy = priv->phy; 
     102        struct mii_bus *bus = phy->bus; 
    96103        u16 r1, r2, r3; 
    97104        u16 lo, hi; 
    98105 
    99106        split_addr((u32) reg, &r1, &r2, &r3); 
    100         mdiobus_write(phy->bus, 0x18, 0, r3); 
    101         msleep(1); /* wait for the page switch to propagate */ 
    102  
    103107        lo = val & 0xffff; 
    104108        hi = (u16) (val >> 16); 
    105         mdiobus_write(phy->bus, 0x10 | r2, r1 + 1, hi); 
    106         mdiobus_write(phy->bus, 0x10 | r2, r1, lo); 
     109 
     110        mutex_lock(&bus->mdio_lock); 
     111 
     112        bus->write(bus, 0x18, 0, r3); 
     113        msleep(1); /* wait for the page switch to propagate */ 
     114        bus->write(bus, 0x10 | r2, r1 + 1, hi); 
     115        bus->write(bus, 0x10 | r2, r1, lo); 
     116 
     117        mutex_unlock(&bus->mdio_lock); 
    107118} 
    108119 
Note: See TracChangeset for help on using the changeset viewer.