Ignore:
Timestamp:
2010-08-08T22:15:10+02:00 (6 years ago)
Author:
nbd
Message:

rtl8366: re-enable learning by default, disabling it broke switching functionality.
add a configuration option for dynamically enabling/disabling this feature.
based on patch from #7637

File:
1 edited

Legend:

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

    r22476 r22545  
    249249        REG_WR(smi, RTL8366RB_PECR, 0); 
    250250 
    251         /* disable learning for all ports */ 
    252         REG_WR(smi, RTL8366RB_SSCR0, RTL8366RB_PORT_ALL); 
    253  
    254         /* disable auto ageing for all ports */ 
    255         REG_WR(smi, RTL8366RB_SSCR1, RTL8366RB_PORT_ALL); 
     251        /* enable learning for all ports */ 
     252        REG_WR(smi, RTL8366RB_SSCR0, 0); 
     253 
     254        /* enable auto ageing for all ports */ 
     255        REG_WR(smi, RTL8366RB_SSCR1, 0); 
    256256 
    257257        /* 
     
    649649                return rtl8366rb_vlan_set_4ktable(smi, val->value.i); 
    650650} 
     651 
     652static int rtl8366rb_sw_get_learning_enable(struct switch_dev *dev, 
     653                                       const struct switch_attr *attr, 
     654                                       struct switch_val *val) 
     655{ 
     656        struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev); 
     657        u32 data; 
     658 
     659        rtl8366_smi_read_reg(smi, RTL8366RB_SSCR0, &data); 
     660        val->value.i = !data; 
     661 
     662        return 0; 
     663} 
     664 
     665 
     666static int rtl8366rb_sw_set_learning_enable(struct switch_dev *dev, 
     667                                       const struct switch_attr *attr, 
     668                                       struct switch_val *val) 
     669{ 
     670        struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev); 
     671        u32 portmask = 0; 
     672        int err = 0; 
     673 
     674        if (!val->value.i) 
     675                portmask = RTL8366RB_PORT_ALL; 
     676 
     677        /* set learning for all ports */ 
     678        REG_WR(smi, RTL8366RB_SSCR0, portmask); 
     679 
     680        /* set auto ageing for all ports */ 
     681        REG_WR(smi, RTL8366RB_SSCR1, portmask); 
     682 
     683        return 0; 
     684} 
     685 
    651686 
    652687static const char *rtl8366rb_speed_str(unsigned speed) 
     
    778813static struct switch_attr rtl8366rb_globals[] = { 
    779814        { 
     815                .type = SWITCH_TYPE_INT, 
     816                .name = "enable_learning", 
     817                .description = "Enable learning, enable aging", 
     818                .set = rtl8366rb_sw_set_learning_enable, 
     819                .get = rtl8366rb_sw_get_learning_enable, 
     820                .max = 1 
     821        }, { 
    780822                .type = SWITCH_TYPE_INT, 
    781823                .name = "enable_vlan", 
Note: See TracChangeset for help on using the changeset viewer.