aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ipg.c48
-rw-r--r--drivers/net/ipg.h32
2 files changed, 41 insertions, 39 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 3099a7b15ecc..5d93eca07b66 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -34,9 +34,9 @@
34 IPG_AC_DMA | IPG_AC_FIFO | IPG_AC_NETWORK | IPG_AC_HOST | \ 34 IPG_AC_DMA | IPG_AC_FIFO | IPG_AC_NETWORK | IPG_AC_HOST | \
35 IPG_AC_AUTO_INIT) 35 IPG_AC_AUTO_INIT)
36 36
37#define ipg_w32(val32,reg) iowrite32((val32), ioaddr + (reg)) 37#define ipg_w32(val32, reg) iowrite32((val32), ioaddr + (reg))
38#define ipg_w16(val16,reg) iowrite16((val16), ioaddr + (reg)) 38#define ipg_w16(val16, reg) iowrite16((val16), ioaddr + (reg))
39#define ipg_w8(val8,reg) iowrite8((val8), ioaddr + (reg)) 39#define ipg_w8(val8, reg) iowrite8((val8), ioaddr + (reg))
40 40
41#define ipg_r32(reg) ioread32(ioaddr + (reg)) 41#define ipg_r32(reg) ioread32(ioaddr + (reg))
42#define ipg_r16(reg) ioread16(ioaddr + (reg)) 42#define ipg_r16(reg) ioread16(ioaddr + (reg))
@@ -54,20 +54,22 @@ MODULE_AUTHOR("IC Plus Corp. 2003");
54MODULE_DESCRIPTION("IC Plus IP1000 Gigabit Ethernet Adapter Linux Driver"); 54MODULE_DESCRIPTION("IC Plus IP1000 Gigabit Ethernet Adapter Linux Driver");
55MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
56 56
57//variable record -- index by leading revision/length 57/*
58//Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN 58 * Variable record -- index by leading revision/length
59 * Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN
60 */
59static unsigned short DefaultPhyParam[] = { 61static unsigned short DefaultPhyParam[] = {
60 // 11/12/03 IP1000A v1-3 rev=0x40 62 /* 11/12/03 IP1000A v1-3 rev=0x40 */
61 /*-------------------------------------------------------------------------- 63 /*--------------------------------------------------------------------------
62 (0x4000|(15*4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 22, 0x85bd, 24, 0xfff2, 64 (0x4000|(15*4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 22, 0x85bd, 24, 0xfff2,
63 27, 0x0c10, 28, 0x0c10, 29, 0x2c10, 31, 0x0003, 23, 0x92f6, 65 27, 0x0c10, 28, 0x0c10, 29, 0x2c10, 31, 0x0003, 23, 0x92f6,
64 31, 0x0000, 23, 0x003d, 30, 0x00de, 20, 0x20e7, 9, 0x0700, 66 31, 0x0000, 23, 0x003d, 30, 0x00de, 20, 0x20e7, 9, 0x0700,
65 --------------------------------------------------------------------------*/ 67 --------------------------------------------------------------------------*/
66 // 12/17/03 IP1000A v1-4 rev=0x40 68 /* 12/17/03 IP1000A v1-4 rev=0x40 */
67 (0x4000 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31, 69 (0x4000 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
68 0x0000, 70 0x0000,
69 30, 0x005e, 9, 0x0700, 71 30, 0x005e, 9, 0x0700,
70 // 01/09/04 IP1000A v1-5 rev=0x41 72 /* 01/09/04 IP1000A v1-5 rev=0x41 */
71 (0x4100 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31, 73 (0x4100 | (07 * 4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 27, 0xeb8e, 31,
72 0x0000, 74 0x0000,
73 30, 0x005e, 9, 0x0700, 75 30, 0x005e, 9, 0x0700,
@@ -187,7 +189,7 @@ static void send_end(void __iomem *ioaddr, u8 phyctrlpolarity)
187 phyctrlpolarity) & IPG_PC_RSVD_MASK, PHY_CTRL); 189 phyctrlpolarity) & IPG_PC_RSVD_MASK, PHY_CTRL);
188} 190}
189 191
190static u16 read_phy_bit(void __iomem * ioaddr, u8 phyctrlpolarity) 192static u16 read_phy_bit(void __iomem *ioaddr, u8 phyctrlpolarity)
191{ 193{
192 u16 bit_data; 194 u16 bit_data;
193 195
@@ -204,7 +206,7 @@ static u16 read_phy_bit(void __iomem * ioaddr, u8 phyctrlpolarity)
204 * Read a register from the Physical Layer device located 206 * Read a register from the Physical Layer device located
205 * on the IPG NIC, using the IPG PHYCTRL register. 207 * on the IPG NIC, using the IPG PHYCTRL register.
206 */ 208 */
207static int mdio_read(struct net_device * dev, int phy_id, int phy_reg) 209static int mdio_read(struct net_device *dev, int phy_id, int phy_reg)
208{ 210{
209 void __iomem *ioaddr = ipg_ioaddr(dev); 211 void __iomem *ioaddr = ipg_ioaddr(dev);
210 /* 212 /*
@@ -548,7 +550,7 @@ static int ipg_config_autoneg(struct net_device *dev)
548 printk("\n"); 550 printk("\n");
549 } else { 551 } else {
550 /* Configure IPG for half duplex operation. */ 552 /* Configure IPG for half duplex operation. */
551 printk(KERN_INFO "%s: setting half duplex, " 553 printk(KERN_INFO "%s: setting half duplex, "
552 "no TX flow control, no RX flow control.\n", dev->name); 554 "no TX flow control, no RX flow control.\n", dev->name);
553 555
554 mac_ctrl_val &= ~IPG_MC_DUPLEX_SELECT_FD & 556 mac_ctrl_val &= ~IPG_MC_DUPLEX_SELECT_FD &
@@ -1080,12 +1082,12 @@ static int ipg_nic_rxrestore(struct net_device *dev)
1080#ifdef JUMBO_FRAME 1082#ifdef JUMBO_FRAME
1081 1083
1082/* use jumboindex and jumbosize to control jumbo frame status 1084/* use jumboindex and jumbosize to control jumbo frame status
1083 initial status is jumboindex=-1 and jumbosize=0 1085 * initial status is jumboindex=-1 and jumbosize=0
1084 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done. 1086 * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done.
1085 2. jumboindex != -1 and jumbosize != 0 : jumbo frame is not over size and receiving 1087 * 2. jumboindex != -1 and jumbosize != 0 : jumbo frame is not over size and receiving
1086 3. jumboindex = -1 and jumbosize != 0 : jumbo frame is over size, already dump 1088 * 3. jumboindex = -1 and jumbosize != 0 : jumbo frame is over size, already dump
1087 previous receiving and need to continue dumping the current one 1089 * previous receiving and need to continue dumping the current one
1088*/ 1090 */
1089enum { 1091enum {
1090 NORMAL_PACKET, 1092 NORMAL_PACKET,
1091 ERROR_PACKET 1093 ERROR_PACKET
@@ -1200,7 +1202,7 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev,
1200 jumbo->skb = NULL; 1202 jumbo->skb = NULL;
1201 } 1203 }
1202 1204
1203 // 1: found error, 0 no error 1205 /* 1: found error, 0 no error */
1204 if (ipg_nic_rx_check_error(dev) != NORMAL_PACKET) 1206 if (ipg_nic_rx_check_error(dev) != NORMAL_PACKET)
1205 return; 1207 return;
1206 1208
@@ -1208,7 +1210,7 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev,
1208 if (!skb) 1210 if (!skb)
1209 return; 1211 return;
1210 1212
1211 // accept this frame and send to upper layer 1213 /* accept this frame and send to upper layer */
1212 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; 1214 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
1213 if (framelen > IPG_RXFRAG_SIZE) 1215 if (framelen > IPG_RXFRAG_SIZE)
1214 framelen = IPG_RXFRAG_SIZE; 1216 framelen = IPG_RXFRAG_SIZE;
@@ -1229,11 +1231,11 @@ static void ipg_nic_rx_with_start(struct net_device *dev,
1229 struct pci_dev *pdev = sp->pdev; 1231 struct pci_dev *pdev = sp->pdev;
1230 struct sk_buff *skb; 1232 struct sk_buff *skb;
1231 1233
1232 // 1: found error, 0 no error 1234 /* 1: found error, 0 no error */
1233 if (ipg_nic_rx_check_error(dev) != NORMAL_PACKET) 1235 if (ipg_nic_rx_check_error(dev) != NORMAL_PACKET)
1234 return; 1236 return;
1235 1237
1236 // accept this frame and send to upper layer 1238 /* accept this frame and send to upper layer */
1237 skb = sp->rx_buff[entry]; 1239 skb = sp->rx_buff[entry];
1238 if (!skb) 1240 if (!skb)
1239 return; 1241 return;
@@ -1260,7 +1262,7 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1260{ 1262{
1261 struct ipg_jumbo *jumbo = &sp->jumbo; 1263 struct ipg_jumbo *jumbo = &sp->jumbo;
1262 1264
1263 //1: found error, 0 no error 1265 /* 1: found error, 0 no error */
1264 if (ipg_nic_rx_check_error(dev) == NORMAL_PACKET) { 1266 if (ipg_nic_rx_check_error(dev) == NORMAL_PACKET) {
1265 struct sk_buff *skb = sp->rx_buff[entry]; 1267 struct sk_buff *skb = sp->rx_buff[entry];
1266 1268
@@ -1311,7 +1313,7 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
1311{ 1313{
1312 struct ipg_jumbo *jumbo = &sp->jumbo; 1314 struct ipg_jumbo *jumbo = &sp->jumbo;
1313 1315
1314 //1: found error, 0 no error 1316 /* 1: found error, 0 no error */
1315 if (ipg_nic_rx_check_error(dev) == NORMAL_PACKET) { 1317 if (ipg_nic_rx_check_error(dev) == NORMAL_PACKET) {
1316 struct sk_buff *skb = sp->rx_buff[entry]; 1318 struct sk_buff *skb = sp->rx_buff[entry];
1317 1319
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index 8b10d6333408..cda53887d4db 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -51,7 +51,7 @@
51/* I/O register offsets. */ 51/* I/O register offsets. */
52enum ipg_regs { 52enum ipg_regs {
53 DMA_CTRL = 0x00, 53 DMA_CTRL = 0x00,
54 RX_DMA_STATUS = 0x08, // Unused + reserved 54 RX_DMA_STATUS = 0x08, /* Unused + reserved */
55 TFD_LIST_PTR_0 = 0x10, 55 TFD_LIST_PTR_0 = 0x10,
56 TFD_LIST_PTR_1 = 0x14, 56 TFD_LIST_PTR_1 = 0x14,
57 TX_DMA_BURST_THRESH = 0x18, 57 TX_DMA_BURST_THRESH = 0x18,
@@ -64,21 +64,21 @@ enum ipg_regs {
64 RX_DMA_POLL_PERIOD = 0x26, 64 RX_DMA_POLL_PERIOD = 0x26,
65 DEBUG_CTRL = 0x2c, 65 DEBUG_CTRL = 0x2c,
66 ASIC_CTRL = 0x30, 66 ASIC_CTRL = 0x30,
67 FIFO_CTRL = 0x38, // Unused 67 FIFO_CTRL = 0x38, /* Unused */
68 FLOW_OFF_THRESH = 0x3c, 68 FLOW_OFF_THRESH = 0x3c,
69 FLOW_ON_THRESH = 0x3e, 69 FLOW_ON_THRESH = 0x3e,
70 EEPROM_DATA = 0x48, 70 EEPROM_DATA = 0x48,
71 EEPROM_CTRL = 0x4a, 71 EEPROM_CTRL = 0x4a,
72 EXPROM_ADDR = 0x4c, // Unused 72 EXPROM_ADDR = 0x4c, /* Unused */
73 EXPROM_DATA = 0x50, // Unused 73 EXPROM_DATA = 0x50, /* Unused */
74 WAKE_EVENT = 0x51, // Unused 74 WAKE_EVENT = 0x51, /* Unused */
75 COUNTDOWN = 0x54, // Unused 75 COUNTDOWN = 0x54, /* Unused */
76 INT_STATUS_ACK = 0x5a, 76 INT_STATUS_ACK = 0x5a,
77 INT_ENABLE = 0x5c, 77 INT_ENABLE = 0x5c,
78 INT_STATUS = 0x5e, // Unused 78 INT_STATUS = 0x5e, /* Unused */
79 TX_STATUS = 0x60, 79 TX_STATUS = 0x60,
80 MAC_CTRL = 0x6c, 80 MAC_CTRL = 0x6c,
81 VLAN_TAG = 0x70, // Unused 81 VLAN_TAG = 0x70, /* Unused */
82 PHY_SET = 0x75, 82 PHY_SET = 0x75,
83 PHY_CTRL = 0x76, 83 PHY_CTRL = 0x76,
84 STATION_ADDRESS_0 = 0x78, 84 STATION_ADDRESS_0 = 0x78,
@@ -90,11 +90,11 @@ enum ipg_regs {
90 HASHTABLE_1 = 0x90, 90 HASHTABLE_1 = 0x90,
91 RMON_STATISTICS_MASK = 0x98, 91 RMON_STATISTICS_MASK = 0x98,
92 STATISTICS_MASK = 0x9c, 92 STATISTICS_MASK = 0x9c,
93 RX_JUMBO_FRAMES = 0xbc, // Unused 93 RX_JUMBO_FRAMES = 0xbc, /* Unused */
94 TCP_CHECKSUM_ERRORS = 0xc0, // Unused 94 TCP_CHECKSUM_ERRORS = 0xc0, /* Unused */
95 IP_CHECKSUM_ERRORS = 0xc2, // Unused 95 IP_CHECKSUM_ERRORS = 0xc2, /* Unused */
96 UDP_CHECKSUM_ERRORS = 0xc4, // Unused 96 UDP_CHECKSUM_ERRORS = 0xc4, /* Unused */
97 TX_JUMBO_FRAMES = 0xf4 // Unused 97 TX_JUMBO_FRAMES = 0xf4 /* Unused */
98}; 98};
99 99
100/* Ethernet MIB statistic register offsets. */ 100/* Ethernet MIB statistic register offsets. */
@@ -590,7 +590,7 @@ enum ipg_regs {
590 * Define larger if expecting jumbo frames. 590 * Define larger if expecting jumbo frames.
591 */ 591 */
592#ifdef JUMBO_FRAME 592#ifdef JUMBO_FRAME
593//IPG_TXFRAG_SIZE must <= 0x2b00, or TX will crash 593/* IPG_TXFRAG_SIZE must <= 0x2b00, or TX will crash */
594#define IPG_TXFRAG_SIZE JUMBO_FRAME_SIZE 594#define IPG_TXFRAG_SIZE JUMBO_FRAME_SIZE
595#endif 595#endif
596 596
@@ -598,7 +598,7 @@ enum ipg_regs {
598 * Define larger if expecting jumbo frames. 598 * Define larger if expecting jumbo frames.
599 */ 599 */
600#ifdef JUMBO_FRAME 600#ifdef JUMBO_FRAME
601//4088=4096-8 601/* 4088 = 4096 - 8 */
602#define IPG_RXFRAG_SIZE __IPG_RXFRAG_SIZE 602#define IPG_RXFRAG_SIZE __IPG_RXFRAG_SIZE
603#define IPG_RXSUPPORT_SIZE IPG_MAX_RXFRAME_SIZE 603#define IPG_RXSUPPORT_SIZE IPG_MAX_RXFRAME_SIZE
604#else 604#else
@@ -628,7 +628,7 @@ enum ipg_regs {
628/* specify the jumbo frame maximum size 628/* specify the jumbo frame maximum size
629 * per unit is 0x600 (the rx_buffer size that one RFD can carry) 629 * per unit is 0x600 (the rx_buffer size that one RFD can carry)
630 */ 630 */
631#define MAX_JUMBOSIZE 0x8 // max is 12K 631#define MAX_JUMBOSIZE 0x8 /* max is 12K */
632 632
633/* Key register values loaded at driver start up. */ 633/* Key register values loaded at driver start up. */
634 634