Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: broadcom: share header defining UniMAC registers

UniMAC is integrated into multiple Broadcom's Ethernet controllers so
use a shared header file for it and avoid some code duplication.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Doug Berger <opendmb@gmail.com>
Link: https://lore.kernel.org/r/20210107180051.1542-2-zajec5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Rafał Miłecki and committed by
Jakub Kicinski
28e303da 12cf8e75

+132 -186
+2
MAINTAINERS
··· 3626 3626 F: Documentation/devicetree/bindings/net/brcm,bcmgenet.txt 3627 3627 F: Documentation/devicetree/bindings/net/brcm,unimac-mdio.txt 3628 3628 F: drivers/net/ethernet/broadcom/genet/ 3629 + F: drivers/net/ethernet/broadcom/unimac.h 3629 3630 F: drivers/net/mdio/mdio-bcm-unimac.c 3630 3631 F: include/linux/platform_data/bcmgenet.h 3631 3632 F: include/linux/platform_data/mdio-bcm-unimac.h ··· 3739 3738 L: netdev@vger.kernel.org 3740 3739 S: Supported 3741 3740 F: drivers/net/ethernet/broadcom/bcmsysport.* 3741 + F: drivers/net/ethernet/broadcom/unimac.h 3742 3742 3743 3743 BROADCOM TG3 GIGABIT ETHERNET DRIVER 3744 3744 M: Siva Reddy Kallam <siva.kallam@broadcom.com>
+2 -33
drivers/net/ethernet/broadcom/bcmsysport.h
··· 13 13 #include <linux/if_vlan.h> 14 14 #include <linux/dim.h> 15 15 16 + #include "unimac.h" 17 + 16 18 /* Receive/transmit descriptor format */ 17 19 #define DESC_ADDR_HI_STATUS_LEN 0x00 18 20 #define DESC_ADDR_HI_SHIFT 0 ··· 214 212 215 213 /* UniMAC offset and defines */ 216 214 #define SYS_PORT_UMAC_OFFSET 0x800 217 - 218 - #define UMAC_CMD 0x008 219 - #define CMD_TX_EN (1 << 0) 220 - #define CMD_RX_EN (1 << 1) 221 - #define CMD_SPEED_SHIFT 2 222 - #define CMD_SPEED_10 0 223 - #define CMD_SPEED_100 1 224 - #define CMD_SPEED_1000 2 225 - #define CMD_SPEED_2500 3 226 - #define CMD_SPEED_MASK 3 227 - #define CMD_PROMISC (1 << 4) 228 - #define CMD_PAD_EN (1 << 5) 229 - #define CMD_CRC_FWD (1 << 6) 230 - #define CMD_PAUSE_FWD (1 << 7) 231 - #define CMD_RX_PAUSE_IGNORE (1 << 8) 232 - #define CMD_TX_ADDR_INS (1 << 9) 233 - #define CMD_HD_EN (1 << 10) 234 - #define CMD_SW_RESET (1 << 13) 235 - #define CMD_LCL_LOOP_EN (1 << 15) 236 - #define CMD_AUTO_CONFIG (1 << 22) 237 - #define CMD_CNTL_FRM_EN (1 << 23) 238 - #define CMD_NO_LEN_CHK (1 << 24) 239 - #define CMD_RMT_LOOP_EN (1 << 25) 240 - #define CMD_PRBL_EN (1 << 27) 241 - #define CMD_TX_PAUSE_IGNORE (1 << 28) 242 - #define CMD_TX_RX_EN (1 << 29) 243 - #define CMD_RUNT_FILTER_DIS (1 << 30) 244 - 245 - #define UMAC_MAC0 0x00c 246 - #define UMAC_MAC1 0x010 247 - #define UMAC_MAX_FRAME_LEN 0x014 248 - 249 - #define UMAC_TX_FLUSH 0x334 250 215 251 216 #define UMAC_MIB_START 0x400 252 217
+49 -49
drivers/net/ethernet/broadcom/bgmac.c
··· 749 749 static void bgmac_umac_cmd_maskset(struct bgmac *bgmac, u32 mask, u32 set, 750 750 bool force) 751 751 { 752 - u32 cmdcfg = bgmac_umac_read(bgmac, BGMAC_CMDCFG); 752 + u32 cmdcfg = bgmac_umac_read(bgmac, UMAC_CMD); 753 753 u32 new_val = (cmdcfg & mask) | set; 754 754 u32 cmdcfg_sr; 755 755 756 756 if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) 757 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; 757 + cmdcfg_sr = CMD_SW_RESET; 758 758 else 759 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; 759 + cmdcfg_sr = CMD_SW_RESET_OLD; 760 760 761 - bgmac_umac_maskset(bgmac, BGMAC_CMDCFG, ~0, cmdcfg_sr); 761 + bgmac_umac_maskset(bgmac, UMAC_CMD, ~0, cmdcfg_sr); 762 762 udelay(2); 763 763 764 764 if (new_val != cmdcfg || force) 765 - bgmac_umac_write(bgmac, BGMAC_CMDCFG, new_val); 765 + bgmac_umac_write(bgmac, UMAC_CMD, new_val); 766 766 767 - bgmac_umac_maskset(bgmac, BGMAC_CMDCFG, ~cmdcfg_sr, 0); 767 + bgmac_umac_maskset(bgmac, UMAC_CMD, ~cmdcfg_sr, 0); 768 768 udelay(2); 769 769 } 770 770 ··· 773 773 u32 tmp; 774 774 775 775 tmp = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]; 776 - bgmac_umac_write(bgmac, BGMAC_MACADDR_HIGH, tmp); 776 + bgmac_umac_write(bgmac, UMAC_MAC0, tmp); 777 777 tmp = (addr[4] << 8) | addr[5]; 778 - bgmac_umac_write(bgmac, BGMAC_MACADDR_LOW, tmp); 778 + bgmac_umac_write(bgmac, UMAC_MAC1, tmp); 779 779 } 780 780 781 781 static void bgmac_set_rx_mode(struct net_device *net_dev) ··· 783 783 struct bgmac *bgmac = netdev_priv(net_dev); 784 784 785 785 if (net_dev->flags & IFF_PROMISC) 786 - bgmac_umac_cmd_maskset(bgmac, ~0, BGMAC_CMDCFG_PROM, true); 786 + bgmac_umac_cmd_maskset(bgmac, ~0, CMD_PROMISC, true); 787 787 else 788 - bgmac_umac_cmd_maskset(bgmac, ~BGMAC_CMDCFG_PROM, 0, true); 788 + bgmac_umac_cmd_maskset(bgmac, ~CMD_PROMISC, 0, true); 789 789 } 790 790 791 791 #if 0 /* We don't use that regs yet */ ··· 825 825 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_speed */ 826 826 static void bgmac_mac_speed(struct bgmac *bgmac) 827 827 { 828 - u32 mask = ~(BGMAC_CMDCFG_ES_MASK | BGMAC_CMDCFG_HD); 828 + u32 mask = ~(CMD_SPEED_MASK << CMD_SPEED_SHIFT | CMD_HD_EN); 829 829 u32 set = 0; 830 830 831 831 switch (bgmac->mac_speed) { 832 832 case SPEED_10: 833 - set |= BGMAC_CMDCFG_ES_10; 833 + set |= CMD_SPEED_10 << CMD_SPEED_SHIFT; 834 834 break; 835 835 case SPEED_100: 836 - set |= BGMAC_CMDCFG_ES_100; 836 + set |= CMD_SPEED_100 << CMD_SPEED_SHIFT; 837 837 break; 838 838 case SPEED_1000: 839 - set |= BGMAC_CMDCFG_ES_1000; 839 + set |= CMD_SPEED_1000 << CMD_SPEED_SHIFT; 840 840 break; 841 841 case SPEED_2500: 842 - set |= BGMAC_CMDCFG_ES_2500; 842 + set |= CMD_SPEED_2500 << CMD_SPEED_SHIFT; 843 843 break; 844 844 default: 845 845 dev_err(bgmac->dev, "Unsupported speed: %d\n", ··· 847 847 } 848 848 849 849 if (bgmac->mac_duplex == DUPLEX_HALF) 850 - set |= BGMAC_CMDCFG_HD; 850 + set |= CMD_HD_EN; 851 851 852 852 bgmac_umac_cmd_maskset(bgmac, mask, set, true); 853 853 } ··· 917 917 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) 918 918 bgmac_dma_tx_reset(bgmac, &bgmac->tx_ring[i]); 919 919 920 - bgmac_umac_cmd_maskset(bgmac, ~0, BGMAC_CMDCFG_ML, false); 920 + bgmac_umac_cmd_maskset(bgmac, ~0, CMD_LCL_LOOP_EN, false); 921 921 udelay(1); 922 922 923 923 for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) ··· 986 986 } 987 987 988 988 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset 989 - * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine 990 - * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to 989 + * Specs don't say about using UMAC_CMD_SR, but in this routine 990 + * UMAC_CMD is read _after_ putting chip in a reset. So it has to 991 991 * be keps until taking MAC out of the reset. 992 992 */ 993 993 if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) 994 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; 994 + cmdcfg_sr = CMD_SW_RESET; 995 995 else 996 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; 996 + cmdcfg_sr = CMD_SW_RESET_OLD; 997 997 998 998 bgmac_umac_cmd_maskset(bgmac, 999 - ~(BGMAC_CMDCFG_TE | 1000 - BGMAC_CMDCFG_RE | 1001 - BGMAC_CMDCFG_RPI | 1002 - BGMAC_CMDCFG_TAI | 1003 - BGMAC_CMDCFG_HD | 1004 - BGMAC_CMDCFG_ML | 1005 - BGMAC_CMDCFG_CFE | 1006 - BGMAC_CMDCFG_RL | 1007 - BGMAC_CMDCFG_RED | 1008 - BGMAC_CMDCFG_PE | 1009 - BGMAC_CMDCFG_TPI | 1010 - BGMAC_CMDCFG_PAD_EN | 1011 - BGMAC_CMDCFG_PF), 1012 - BGMAC_CMDCFG_PROM | 1013 - BGMAC_CMDCFG_NLC | 1014 - BGMAC_CMDCFG_CFE | 999 + ~(CMD_TX_EN | 1000 + CMD_RX_EN | 1001 + CMD_RX_PAUSE_IGNORE | 1002 + CMD_TX_ADDR_INS | 1003 + CMD_HD_EN | 1004 + CMD_LCL_LOOP_EN | 1005 + CMD_CNTL_FRM_EN | 1006 + CMD_RMT_LOOP_EN | 1007 + CMD_RX_ERR_DISC | 1008 + CMD_PRBL_EN | 1009 + CMD_TX_PAUSE_IGNORE | 1010 + CMD_PAD_EN | 1011 + CMD_PAUSE_FWD), 1012 + CMD_PROMISC | 1013 + CMD_NO_LEN_CHK | 1014 + CMD_CNTL_FRM_EN | 1015 1015 cmdcfg_sr, 1016 1016 false); 1017 1017 bgmac->mac_speed = SPEED_UNKNOWN; ··· 1049 1049 u32 mode; 1050 1050 1051 1051 if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) 1052 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; 1052 + cmdcfg_sr = CMD_SW_RESET; 1053 1053 else 1054 - cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; 1054 + cmdcfg_sr = CMD_SW_RESET_OLD; 1055 1055 1056 - cmdcfg = bgmac_umac_read(bgmac, BGMAC_CMDCFG); 1057 - bgmac_umac_cmd_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE), 1056 + cmdcfg = bgmac_umac_read(bgmac, UMAC_CMD); 1057 + bgmac_umac_cmd_maskset(bgmac, ~(CMD_TX_EN | CMD_RX_EN), 1058 1058 cmdcfg_sr, true); 1059 1059 udelay(2); 1060 - cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE; 1061 - bgmac_umac_write(bgmac, BGMAC_CMDCFG, cmdcfg); 1060 + cmdcfg |= CMD_TX_EN | CMD_RX_EN; 1061 + bgmac_umac_write(bgmac, UMAC_CMD, cmdcfg); 1062 1062 1063 1063 mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >> 1064 1064 BGMAC_DS_MM_SHIFT; ··· 1078 1078 fl_ctl = 0x03cb04cb; 1079 1079 1080 1080 bgmac_write(bgmac, BGMAC_FLOW_CTL_THRESH, fl_ctl); 1081 - bgmac_umac_write(bgmac, BGMAC_PAUSE_CTL, 0x27fff); 1081 + bgmac_umac_write(bgmac, UMAC_PAUSE_CTRL, 0x27fff); 1082 1082 } 1083 1083 1084 1084 if (bgmac->feature_flags & BGMAC_FEAT_SET_RXQ_CLK) { ··· 1105 1105 bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT); 1106 1106 1107 1107 /* Enable 802.3x tx flow control (honor received PAUSE frames) */ 1108 - bgmac_umac_cmd_maskset(bgmac, ~BGMAC_CMDCFG_RPI, 0, true); 1108 + bgmac_umac_cmd_maskset(bgmac, ~CMD_RX_PAUSE_IGNORE, 0, true); 1109 1109 1110 1110 bgmac_set_rx_mode(bgmac->net_dev); 1111 1111 1112 1112 bgmac_write_mac_address(bgmac, bgmac->net_dev->dev_addr); 1113 1113 1114 1114 if (bgmac->loopback) 1115 - bgmac_umac_cmd_maskset(bgmac, ~0, BGMAC_CMDCFG_ML, false); 1115 + bgmac_umac_cmd_maskset(bgmac, ~0, CMD_LCL_LOOP_EN, false); 1116 1116 else 1117 - bgmac_umac_cmd_maskset(bgmac, ~BGMAC_CMDCFG_ML, 0, false); 1117 + bgmac_umac_cmd_maskset(bgmac, ~CMD_LCL_LOOP_EN, 0, false); 1118 1118 1119 - bgmac_umac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN); 1119 + bgmac_umac_write(bgmac, UMAC_MAX_FRAME_LEN, 32 + ETHER_MAX_LEN); 1120 1120 1121 1121 bgmac_chip_intrs_on(bgmac); 1122 1122 ··· 1252 1252 { 1253 1253 struct bgmac *bgmac = netdev_priv(net_dev); 1254 1254 1255 - bgmac_umac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + mtu); 1255 + bgmac_umac_write(bgmac, UMAC_MAX_FRAME_LEN, 32 + mtu); 1256 1256 return 0; 1257 1257 } 1258 1258
+6 -44
drivers/net/ethernet/broadcom/bgmac.h
··· 4 4 5 5 #include <linux/netdevice.h> 6 6 7 + #include "unimac.h" 8 + 7 9 #define BGMAC_DEV_CTL 0x000 8 10 #define BGMAC_DC_TSM 0x00000002 9 11 #define BGMAC_DC_CFCO 0x00000004 ··· 171 169 #define BGMAC_RX_NONPAUSE_PKTS 0x420 172 170 #define BGMAC_RX_SACHANGES 0x424 173 171 #define BGMAC_RX_UNI_PKTS 0x428 174 - #define BGMAC_UNIMAC_VERSION 0x800 175 - #define BGMAC_HDBKP_CTL 0x804 176 - #define BGMAC_CMDCFG 0x808 /* Configuration */ 177 - #define BGMAC_CMDCFG_TE 0x00000001 /* Set to activate TX */ 178 - #define BGMAC_CMDCFG_RE 0x00000002 /* Set to activate RX */ 179 - #define BGMAC_CMDCFG_ES_MASK 0x0000000c /* Ethernet speed see gmac_speed */ 180 - #define BGMAC_CMDCFG_ES_10 0x00000000 181 - #define BGMAC_CMDCFG_ES_100 0x00000004 182 - #define BGMAC_CMDCFG_ES_1000 0x00000008 183 - #define BGMAC_CMDCFG_ES_2500 0x0000000C 184 - #define BGMAC_CMDCFG_PROM 0x00000010 /* Set to activate promiscuous mode */ 185 - #define BGMAC_CMDCFG_PAD_EN 0x00000020 186 - #define BGMAC_CMDCFG_CF 0x00000040 187 - #define BGMAC_CMDCFG_PF 0x00000080 188 - #define BGMAC_CMDCFG_RPI 0x00000100 /* Unset to enable 802.3x tx flow control */ 189 - #define BGMAC_CMDCFG_TAI 0x00000200 190 - #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ 191 - #define BGMAC_CMDCFG_HD_SHIFT 10 192 - #define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */ 193 - #define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */ 194 - #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ 195 - #define BGMAC_CMDCFG_AE 0x00400000 196 - #define BGMAC_CMDCFG_CFE 0x00800000 197 - #define BGMAC_CMDCFG_NLC 0x01000000 198 - #define BGMAC_CMDCFG_RL 0x02000000 199 - #define BGMAC_CMDCFG_RED 0x04000000 200 - #define BGMAC_CMDCFG_PE 0x08000000 201 - #define BGMAC_CMDCFG_TPI 0x10000000 202 - #define BGMAC_CMDCFG_AT 0x20000000 203 - #define BGMAC_MACADDR_HIGH 0x80c /* High 4 octets of own mac address */ 204 - #define BGMAC_MACADDR_LOW 0x810 /* Low 2 octets of own mac address */ 205 - #define BGMAC_RXMAX_LENGTH 0x814 /* Max receive frame length with vlan tag */ 206 - #define BGMAC_PAUSEQUANTA 0x818 207 - #define BGMAC_MAC_MODE 0x844 208 - #define BGMAC_OUTERTAG 0x848 209 - #define BGMAC_INNERTAG 0x84c 210 - #define BGMAC_TXIPG 0x85c 211 - #define BGMAC_PAUSE_CTL 0xb30 212 - #define BGMAC_TX_FLUSH 0xb34 213 - #define BGMAC_RX_STATUS 0xb38 214 - #define BGMAC_TX_STATUS 0xb3c 172 + #define BGMAC_UNIMAC 0x800 215 173 216 174 /* BCMA GMAC core specific IO Control (BCMA_IOCTL) flags */ 217 175 #define BGMAC_BCMA_IOCTL_SW_CLKEN 0x00000004 /* PHY Clock Enable */ ··· 520 558 521 559 static inline u32 bgmac_umac_read(struct bgmac *bgmac, u16 offset) 522 560 { 523 - return bgmac_read(bgmac, offset); 561 + return bgmac_read(bgmac, BGMAC_UNIMAC + offset); 524 562 } 525 563 526 564 static inline void bgmac_umac_write(struct bgmac *bgmac, u16 offset, u32 value) 527 565 { 528 - bgmac_write(bgmac, offset, value); 566 + bgmac_write(bgmac, BGMAC_UNIMAC + offset, value); 529 567 } 530 568 531 569 static inline u32 bgmac_idm_read(struct bgmac *bgmac, u16 offset) ··· 583 621 584 622 static inline void bgmac_umac_maskset(struct bgmac *bgmac, u16 offset, u32 mask, u32 set) 585 623 { 586 - bgmac_maskset(bgmac, offset, mask, set); 624 + bgmac_maskset(bgmac, BGMAC_UNIMAC + offset, mask, set); 587 625 } 588 626 589 627 static inline int bgmac_phy_connect(struct bgmac *bgmac)
+2 -57
drivers/net/ethernet/broadcom/genet/bcmgenet.h
··· 16 16 #include <linux/dim.h> 17 17 #include <linux/ethtool.h> 18 18 19 + #include "../unimac.h" 20 + 19 21 /* total number of Buffer Descriptors, same for Rx/Tx */ 20 22 #define TOTAL_DESC 256 21 23 ··· 151 149 u32 tx_realloc_tsb; 152 150 u32 tx_realloc_tsb_failed; 153 151 }; 154 - 155 - #define UMAC_HD_BKP_CTRL 0x004 156 - #define HD_FC_EN (1 << 0) 157 - #define HD_FC_BKOFF_OK (1 << 1) 158 - #define IPG_CONFIG_RX_SHIFT 2 159 - #define IPG_CONFIG_RX_MASK 0x1F 160 - 161 - #define UMAC_CMD 0x008 162 - #define CMD_TX_EN (1 << 0) 163 - #define CMD_RX_EN (1 << 1) 164 - #define UMAC_SPEED_10 0 165 - #define UMAC_SPEED_100 1 166 - #define UMAC_SPEED_1000 2 167 - #define UMAC_SPEED_2500 3 168 - #define CMD_SPEED_SHIFT 2 169 - #define CMD_SPEED_MASK 3 170 - #define CMD_PROMISC (1 << 4) 171 - #define CMD_PAD_EN (1 << 5) 172 - #define CMD_CRC_FWD (1 << 6) 173 - #define CMD_PAUSE_FWD (1 << 7) 174 - #define CMD_RX_PAUSE_IGNORE (1 << 8) 175 - #define CMD_TX_ADDR_INS (1 << 9) 176 - #define CMD_HD_EN (1 << 10) 177 - #define CMD_SW_RESET (1 << 13) 178 - #define CMD_LCL_LOOP_EN (1 << 15) 179 - #define CMD_AUTO_CONFIG (1 << 22) 180 - #define CMD_CNTL_FRM_EN (1 << 23) 181 - #define CMD_NO_LEN_CHK (1 << 24) 182 - #define CMD_RMT_LOOP_EN (1 << 25) 183 - #define CMD_PRBL_EN (1 << 27) 184 - #define CMD_TX_PAUSE_IGNORE (1 << 28) 185 - #define CMD_TX_RX_EN (1 << 29) 186 - #define CMD_RUNT_FILTER_DIS (1 << 30) 187 - 188 - #define UMAC_MAC0 0x00C 189 - #define UMAC_MAC1 0x010 190 - #define UMAC_MAX_FRAME_LEN 0x014 191 - 192 - #define UMAC_MODE 0x44 193 - #define MODE_LINK_STATUS (1 << 5) 194 - 195 - #define UMAC_EEE_CTRL 0x064 196 - #define EN_LPI_RX_PAUSE (1 << 0) 197 - #define EN_LPI_TX_PFC (1 << 1) 198 - #define EN_LPI_TX_PAUSE (1 << 2) 199 - #define EEE_EN (1 << 3) 200 - #define RX_FIFO_CHECK (1 << 4) 201 - #define EEE_TX_CLK_DIS (1 << 5) 202 - #define DIS_EEE_10M (1 << 6) 203 - #define LP_IDLE_PREDICTION_MODE (1 << 7) 204 - 205 - #define UMAC_EEE_LPI_TIMER 0x068 206 - #define UMAC_EEE_WAKE_TIMER 0x06C 207 - #define UMAC_EEE_REF_COUNT 0x070 208 - #define EEE_REFERENCE_COUNT_MASK 0xffff 209 - 210 - #define UMAC_TX_FLUSH 0x334 211 152 212 153 #define UMAC_MIB_START 0x400 213 154
+3 -3
drivers/net/ethernet/broadcom/genet/bcmmii.c
··· 63 63 64 64 /* speed */ 65 65 if (phydev->speed == SPEED_1000) 66 - cmd_bits = UMAC_SPEED_1000; 66 + cmd_bits = CMD_SPEED_1000; 67 67 else if (phydev->speed == SPEED_100) 68 - cmd_bits = UMAC_SPEED_100; 68 + cmd_bits = CMD_SPEED_100; 69 69 else 70 - cmd_bits = UMAC_SPEED_10; 70 + cmd_bits = CMD_SPEED_10; 71 71 cmd_bits <<= CMD_SPEED_SHIFT; 72 72 73 73 /* duplex */
+68
drivers/net/ethernet/broadcom/unimac.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #ifndef __UNIMAC_H 3 + #define __UNIMAC_H 4 + 5 + #define UMAC_HD_BKP_CTRL 0x004 6 + #define HD_FC_EN (1 << 0) 7 + #define HD_FC_BKOFF_OK (1 << 1) 8 + #define IPG_CONFIG_RX_SHIFT 2 9 + #define IPG_CONFIG_RX_MASK 0x1F 10 + #define UMAC_CMD 0x008 11 + #define CMD_TX_EN (1 << 0) 12 + #define CMD_RX_EN (1 << 1) 13 + #define CMD_SPEED_10 0 14 + #define CMD_SPEED_100 1 15 + #define CMD_SPEED_1000 2 16 + #define CMD_SPEED_2500 3 17 + #define CMD_SPEED_SHIFT 2 18 + #define CMD_SPEED_MASK 3 19 + #define CMD_PROMISC (1 << 4) 20 + #define CMD_PAD_EN (1 << 5) 21 + #define CMD_CRC_FWD (1 << 6) 22 + #define CMD_PAUSE_FWD (1 << 7) 23 + #define CMD_RX_PAUSE_IGNORE (1 << 8) 24 + #define CMD_TX_ADDR_INS (1 << 9) 25 + #define CMD_HD_EN (1 << 10) 26 + #define CMD_SW_RESET_OLD (1 << 11) 27 + #define CMD_SW_RESET (1 << 13) 28 + #define CMD_LCL_LOOP_EN (1 << 15) 29 + #define CMD_AUTO_CONFIG (1 << 22) 30 + #define CMD_CNTL_FRM_EN (1 << 23) 31 + #define CMD_NO_LEN_CHK (1 << 24) 32 + #define CMD_RMT_LOOP_EN (1 << 25) 33 + #define CMD_RX_ERR_DISC (1 << 26) 34 + #define CMD_PRBL_EN (1 << 27) 35 + #define CMD_TX_PAUSE_IGNORE (1 << 28) 36 + #define CMD_TX_RX_EN (1 << 29) 37 + #define CMD_RUNT_FILTER_DIS (1 << 30) 38 + #define UMAC_MAC0 0x00c 39 + #define UMAC_MAC1 0x010 40 + #define UMAC_MAX_FRAME_LEN 0x014 41 + #define UMAC_PAUSE_QUANTA 0x018 42 + #define UMAC_MODE 0x044 43 + #define MODE_LINK_STATUS (1 << 5) 44 + #define UMAC_FRM_TAG0 0x048 /* outer tag */ 45 + #define UMAC_FRM_TAG1 0x04c /* inner tag */ 46 + #define UMAC_TX_IPG_LEN 0x05c 47 + #define UMAC_EEE_CTRL 0x064 48 + #define EN_LPI_RX_PAUSE (1 << 0) 49 + #define EN_LPI_TX_PFC (1 << 1) 50 + #define EN_LPI_TX_PAUSE (1 << 2) 51 + #define EEE_EN (1 << 3) 52 + #define RX_FIFO_CHECK (1 << 4) 53 + #define EEE_TX_CLK_DIS (1 << 5) 54 + #define DIS_EEE_10M (1 << 6) 55 + #define LP_IDLE_PREDICTION_MODE (1 << 7) 56 + #define UMAC_EEE_LPI_TIMER 0x068 57 + #define UMAC_EEE_WAKE_TIMER 0x06C 58 + #define UMAC_EEE_REF_COUNT 0x070 59 + #define EEE_REFERENCE_COUNT_MASK 0xffff 60 + #define UMAC_RX_IPG_INV 0x078 61 + #define UMAC_MACSEC_PROG_TX_CRC 0x310 62 + #define UMAC_MACSEC_CTRL 0x314 63 + #define UMAC_PAUSE_CTRL 0x330 64 + #define UMAC_TX_FLUSH 0x334 65 + #define UMAC_RX_FIFO_STATUS 0x338 66 + #define UMAC_TX_FIFO_STATUS 0x33c 67 + 68 + #endif