mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 22:44:27 -05:00 
			
		
		
		
	kernel: set and get mc index for rtl8367d family chips
Set and get mc index for rtl8367d family chips Co-authored-by: Serge Vasilugin <vasilugin@yandex.ru> Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/14804 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
		
							parent
							
								
									2283e746d8
								
							
						
					
					
						commit
						dd2af4711a
					
				@ -276,6 +276,10 @@ struct rtl8367b_initval {
 | 
				
			|||||||
#define RTL8367D_REG_MAC0_FORCE_SELECT		0x12c0
 | 
					#define RTL8367D_REG_MAC0_FORCE_SELECT		0x12c0
 | 
				
			||||||
#define RTL8367D_REG_MAC0_FORCE_SELECT_EN	0x12c8
 | 
					#define RTL8367D_REG_MAC0_FORCE_SELECT_EN	0x12c8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RTL8367D_VLAN_PVID_CTRL_REG(_p)		(0x0700 + (_p))
 | 
				
			||||||
 | 
					#define RTL8367D_VLAN_PVID_CTRL_MASK		0xfff
 | 
				
			||||||
 | 
					#define RTL8367D_VLAN_PVID_CTRL_SHIFT(_p)	0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct rtl8366_mib_counter
 | 
					static struct rtl8366_mib_counter
 | 
				
			||||||
rtl8367b_mib_counters[RTL8367B_NUM_MIB_COUNTERS] = {
 | 
					rtl8367b_mib_counters[RTL8367B_NUM_MIB_COUNTERS] = {
 | 
				
			||||||
	{0,   0, 4, "ifInOctets"			},
 | 
						{0,   0, 4, "ifInOctets"			},
 | 
				
			||||||
@ -1040,10 +1044,17 @@ static int rtl8367b_get_mc_index(struct rtl8366_smi *smi, int port, int *val)
 | 
				
			|||||||
	if (port >= RTL8367B_NUM_PORTS)
 | 
						if (port >= RTL8367B_NUM_PORTS)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	REG_RD(smi, RTL8367B_VLAN_PVID_CTRL_REG(port), &data);
 | 
						if (smi->rtl8367b_chip >= RTL8367B_CHIP_RTL8367S_VB) { /* Family D */
 | 
				
			||||||
 | 
							REG_RD(smi, RTL8367D_VLAN_PVID_CTRL_REG(port), &data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*val = (data >> RTL8367B_VLAN_PVID_CTRL_SHIFT(port)) &
 | 
							*val = (data >> RTL8367D_VLAN_PVID_CTRL_SHIFT(port)) &
 | 
				
			||||||
	       RTL8367B_VLAN_PVID_CTRL_MASK;
 | 
								RTL8367D_VLAN_PVID_CTRL_MASK;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							REG_RD(smi, RTL8367B_VLAN_PVID_CTRL_REG(port), &data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							*val = (data >> RTL8367B_VLAN_PVID_CTRL_SHIFT(port)) &
 | 
				
			||||||
 | 
								RTL8367B_VLAN_PVID_CTRL_MASK;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1053,7 +1064,14 @@ static int rtl8367b_set_mc_index(struct rtl8366_smi *smi, int port, int index)
 | 
				
			|||||||
	if (port >= RTL8367B_NUM_PORTS || index >= RTL8367B_NUM_VLANS)
 | 
						if (port >= RTL8367B_NUM_PORTS || index >= RTL8367B_NUM_VLANS)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return rtl8366_smi_rmwr(smi, RTL8367B_VLAN_PVID_CTRL_REG(port),
 | 
						if (smi->rtl8367b_chip >= RTL8367B_CHIP_RTL8367S_VB) /* Family D */
 | 
				
			||||||
 | 
							return rtl8366_smi_rmwr(smi, RTL8367D_VLAN_PVID_CTRL_REG(port),
 | 
				
			||||||
 | 
									RTL8367D_VLAN_PVID_CTRL_MASK <<
 | 
				
			||||||
 | 
										RTL8367D_VLAN_PVID_CTRL_SHIFT(port),
 | 
				
			||||||
 | 
									(index & RTL8367D_VLAN_PVID_CTRL_MASK) <<
 | 
				
			||||||
 | 
										RTL8367D_VLAN_PVID_CTRL_SHIFT(port));
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							return rtl8366_smi_rmwr(smi, RTL8367B_VLAN_PVID_CTRL_REG(port),
 | 
				
			||||||
				RTL8367B_VLAN_PVID_CTRL_MASK <<
 | 
									RTL8367B_VLAN_PVID_CTRL_MASK <<
 | 
				
			||||||
					RTL8367B_VLAN_PVID_CTRL_SHIFT(port),
 | 
										RTL8367B_VLAN_PVID_CTRL_SHIFT(port),
 | 
				
			||||||
				(index & RTL8367B_VLAN_PVID_CTRL_MASK) <<
 | 
									(index & RTL8367B_VLAN_PVID_CTRL_MASK) <<
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user