diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-05-31 19:22:06 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-06-12 02:40:24 -0400 |
commit | d9a073ea166983e180438e2989b07ec1b70bc1f5 (patch) | |
tree | e635bef8f56b0fcc23348225da77d4294790b046 /drivers/net/mv643xx_eth.c | |
parent | 3cb4667c5b35ad3cafe57f24dab5284056d89df1 (diff) |
mv643xx_eth: get rid of individual port config register bit defines
The mv643xx_eth driver only ever changes bit 0 of the port config
register at run time, the rest of the register bits are fixed (and
always zero). Document the meaning of the chosen default value,
and get rid of all the defines for each of the individual bits.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 76cf89c3ee27..6987485d0af0 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -96,6 +96,7 @@ static char mv643xx_driver_version[] = "1.0"; | |||
96 | * Per-port registers. | 96 | * Per-port registers. |
97 | */ | 97 | */ |
98 | #define PORT_CONFIG(p) (0x0400 + ((p) << 10)) | 98 | #define PORT_CONFIG(p) (0x0400 + ((p) << 10)) |
99 | #define UNICAST_PROMISCUOUS_MODE 0x00000001 | ||
99 | #define PORT_CONFIG_EXT(p) (0x0404 + ((p) << 10)) | 100 | #define PORT_CONFIG_EXT(p) (0x0404 + ((p) << 10)) |
100 | #define MAC_ADDR_LOW(p) (0x0414 + ((p) << 10)) | 101 | #define MAC_ADDR_LOW(p) (0x0414 + ((p) << 10)) |
101 | #define MAC_ADDR_HIGH(p) (0x0418 + ((p) << 10)) | 102 | #define MAC_ADDR_HIGH(p) (0x0418 + ((p) << 10)) |
@@ -117,39 +118,6 @@ static char mv643xx_driver_version[] = "1.0"; | |||
117 | #define OTHER_MCAST_TABLE(p) (0x1500 + ((p) << 10)) | 118 | #define OTHER_MCAST_TABLE(p) (0x1500 + ((p) << 10)) |
118 | #define UNICAST_TABLE(p) (0x1600 + ((p) << 10)) | 119 | #define UNICAST_TABLE(p) (0x1600 + ((p) << 10)) |
119 | 120 | ||
120 | /* These macros describe Ethernet Port configuration reg (Px_cR) bits */ | ||
121 | #define UNICAST_NORMAL_MODE (0 << 0) | ||
122 | #define UNICAST_PROMISCUOUS_MODE (1 << 0) | ||
123 | #define DEFAULT_RX_QUEUE(queue) ((queue) << 1) | ||
124 | #define DEFAULT_RX_ARP_QUEUE(queue) ((queue) << 4) | ||
125 | #define RECEIVE_BC_IF_NOT_IP_OR_ARP (0 << 7) | ||
126 | #define REJECT_BC_IF_NOT_IP_OR_ARP (1 << 7) | ||
127 | #define RECEIVE_BC_IF_IP (0 << 8) | ||
128 | #define REJECT_BC_IF_IP (1 << 8) | ||
129 | #define RECEIVE_BC_IF_ARP (0 << 9) | ||
130 | #define REJECT_BC_IF_ARP (1 << 9) | ||
131 | #define TX_AM_NO_UPDATE_ERROR_SUMMARY (1 << 12) | ||
132 | #define CAPTURE_TCP_FRAMES_DIS (0 << 14) | ||
133 | #define CAPTURE_TCP_FRAMES_EN (1 << 14) | ||
134 | #define CAPTURE_UDP_FRAMES_DIS (0 << 15) | ||
135 | #define CAPTURE_UDP_FRAMES_EN (1 << 15) | ||
136 | #define DEFAULT_RX_TCP_QUEUE(queue) ((queue) << 16) | ||
137 | #define DEFAULT_RX_UDP_QUEUE(queue) ((queue) << 19) | ||
138 | #define DEFAULT_RX_BPDU_QUEUE(queue) ((queue) << 22) | ||
139 | |||
140 | #define PORT_CONFIG_DEFAULT_VALUE \ | ||
141 | UNICAST_NORMAL_MODE | \ | ||
142 | DEFAULT_RX_QUEUE(0) | \ | ||
143 | DEFAULT_RX_ARP_QUEUE(0) | \ | ||
144 | RECEIVE_BC_IF_NOT_IP_OR_ARP | \ | ||
145 | RECEIVE_BC_IF_IP | \ | ||
146 | RECEIVE_BC_IF_ARP | \ | ||
147 | CAPTURE_TCP_FRAMES_DIS | \ | ||
148 | CAPTURE_UDP_FRAMES_DIS | \ | ||
149 | DEFAULT_RX_TCP_QUEUE(0) | \ | ||
150 | DEFAULT_RX_UDP_QUEUE(0) | \ | ||
151 | DEFAULT_RX_BPDU_QUEUE(0) | ||
152 | |||
153 | /* These macros describe Ethernet Port configuration extend reg (Px_cXR) bits*/ | 121 | /* These macros describe Ethernet Port configuration extend reg (Px_cXR) bits*/ |
154 | #define CLASSIFY_EN (1 << 0) | 122 | #define CLASSIFY_EN (1 << 0) |
155 | #define SPAN_BPDU_PACKETS_AS_NORMAL (0 << 1) | 123 | #define SPAN_BPDU_PACKETS_AS_NORMAL (0 << 1) |
@@ -1810,9 +1778,9 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev) | |||
1810 | 1778 | ||
1811 | config_reg = rdl(mp, PORT_CONFIG(mp->port_num)); | 1779 | config_reg = rdl(mp, PORT_CONFIG(mp->port_num)); |
1812 | if (dev->flags & IFF_PROMISC) | 1780 | if (dev->flags & IFF_PROMISC) |
1813 | config_reg |= (u32) UNICAST_PROMISCUOUS_MODE; | 1781 | config_reg |= UNICAST_PROMISCUOUS_MODE; |
1814 | else | 1782 | else |
1815 | config_reg &= ~(u32) UNICAST_PROMISCUOUS_MODE; | 1783 | config_reg &= ~UNICAST_PROMISCUOUS_MODE; |
1816 | wrl(mp, PORT_CONFIG(mp->port_num), config_reg); | 1784 | wrl(mp, PORT_CONFIG(mp->port_num), config_reg); |
1817 | 1785 | ||
1818 | eth_port_set_multicast_list(dev); | 1786 | eth_port_set_multicast_list(dev); |
@@ -2234,8 +2202,11 @@ static void eth_port_start(struct net_device *dev) | |||
2234 | /* Add the assigned Ethernet address to the port's address table */ | 2202 | /* Add the assigned Ethernet address to the port's address table */ |
2235 | eth_port_uc_addr_set(mp, dev->dev_addr); | 2203 | eth_port_uc_addr_set(mp, dev->dev_addr); |
2236 | 2204 | ||
2237 | /* Assign port configuration and command. */ | 2205 | /* |
2238 | wrl(mp, PORT_CONFIG(port_num), PORT_CONFIG_DEFAULT_VALUE); | 2206 | * Receive all unmatched unicast, TCP, UDP, BPDU and broadcast |
2207 | * frames to RX queue #0. | ||
2208 | */ | ||
2209 | wrl(mp, PORT_CONFIG(port_num), 0x00000000); | ||
2239 | 2210 | ||
2240 | wrl(mp, PORT_CONFIG_EXT(port_num), PORT_CONFIG_EXTEND_DEFAULT_VALUE); | 2211 | wrl(mp, PORT_CONFIG_EXT(port_num), PORT_CONFIG_EXTEND_DEFAULT_VALUE); |
2241 | 2212 | ||