Changeset 29844


Ignore:
Timestamp:
2012-01-21T23:44:09+01:00 (6 years ago)
Author:
juhosg
Message:

generic: rtl8366: add rtl8366_smi_write_reg_noack helper

After issuing a soft reset on the RT8366{S,RB}
switch, waiting for the last acknowlegement fails
in rtl8366_smi_write_reg. Add a _noack version of
the function and use that for issuing a soft reset.

Location:
trunk/target/linux/generic/files/drivers/net/phy
Files:
4 edited

Legend:

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

    r29732 r29844  
    158158} 
    159159 
     160static int rtl8366_smi_write_byte_noack(struct rtl8366_smi *smi, u8 data) 
     161{ 
     162        rtl8366_smi_write_bits(smi, data, 8); 
     163        return 0; 
     164} 
     165 
    160166static int rtl8366_smi_read_byte0(struct rtl8366_smi *smi, u8 *data) 
    161167{ 
     
    229235EXPORT_SYMBOL_GPL(rtl8366_smi_read_reg); 
    230236 
    231 int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data) 
     237static int __rtl8366_smi_write_reg(struct rtl8366_smi *smi, 
     238                                   u32 addr, u32 data, bool ack) 
    232239{ 
    233240        unsigned long flags; 
     
    259266 
    260267        /* write DATA[15:8] */ 
    261         ret = rtl8366_smi_write_byte(smi, data >> 8); 
     268        if (ack) 
     269                ret = rtl8366_smi_write_byte(smi, data >> 8); 
     270        else 
     271                ret = rtl8366_smi_write_byte_noack(smi, data >> 8); 
    262272        if (ret) 
    263273                goto out; 
     
    271281        return ret; 
    272282} 
     283 
     284int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data) 
     285{ 
     286        return __rtl8366_smi_write_reg(smi, addr, data, true); 
     287} 
    273288EXPORT_SYMBOL_GPL(rtl8366_smi_write_reg); 
     289 
     290int rtl8366_smi_write_reg_noack(struct rtl8366_smi *smi, u32 addr, u32 data) 
     291{ 
     292        return __rtl8366_smi_write_reg(smi, addr, data, false); 
     293} 
     294EXPORT_SYMBOL_GPL(rtl8366_smi_write_reg_noack); 
    274295 
    275296int rtl8366_smi_rmwr(struct rtl8366_smi *smi, u32 addr, u32 mask, u32 data) 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h

    r29677 r29844  
    104104void rtl8366_smi_cleanup(struct rtl8366_smi *smi); 
    105105int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data); 
     106int rtl8366_smi_write_reg_noack(struct rtl8366_smi *smi, u32 addr, u32 data); 
    106107int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data); 
    107108int rtl8366_smi_rmwr(struct rtl8366_smi *smi, u32 addr, u32 mask, u32 data); 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366rb.c

    r29677 r29844  
    247247        u32 data; 
    248248 
    249         rtl8366_smi_write_reg(smi, RTL8366RB_RESET_CTRL_REG, 
    250                               RTL8366RB_CHIP_CTRL_RESET_HW); 
     249        rtl8366_smi_write_reg_noack(smi, RTL8366RB_RESET_CTRL_REG, 
     250                                    RTL8366RB_CHIP_CTRL_RESET_HW); 
    251251        do { 
    252252                msleep(1); 
  • trunk/target/linux/generic/files/drivers/net/phy/rtl8366s.c

    r29677 r29844  
    230230        u32 data; 
    231231 
    232         rtl8366_smi_write_reg(smi, RTL8366S_RESET_CTRL_REG, 
    233                               RTL8366S_CHIP_CTRL_RESET_HW); 
     232        rtl8366_smi_write_reg_noack(smi, RTL8366S_RESET_CTRL_REG, 
     233                                    RTL8366S_CHIP_CTRL_RESET_HW); 
    234234        do { 
    235235                msleep(1); 
Note: See TracChangeset for help on using the changeset viewer.