[8bb5996] | 1 | Submitted By: Jim Gifford (patches at jg555 dot com) |
---|
[e89ec63] | 2 | Date: 2006-11-29 |
---|
| 3 | Initial Package Version: 2.6.19 |
---|
[8bb5996] | 4 | Origin: Grant Gundler (parisc linux) |
---|
| 5 | Upstream Status: in -mm |
---|
| 6 | Description: Make the tulip drivers follow the chipset specs |
---|
[e89ec63] | 7 | |
---|
| 8 | diff -Naur linux-2.6.19.orig/drivers/net/tulip/21142.c linux-2.6.19/drivers/net/tulip/21142.c |
---|
| 9 | --- linux-2.6.19.orig/drivers/net/tulip/21142.c 2006-11-29 13:57:37.000000000 -0800 |
---|
| 10 | +++ linux-2.6.19/drivers/net/tulip/21142.c 2006-11-29 19:27:20.000000000 -0800 |
---|
[8bb5996] | 11 | @@ -172,7 +172,7 @@ |
---|
| 12 | int i; |
---|
| 13 | for (i = 0; i < tp->mtable->leafcount; i++) |
---|
| 14 | if (tp->mtable->mleaf[i].media == dev->if_port) { |
---|
| 15 | - int startup = ! ((tp->chip_id == DC21143 && (tp->revision == 48 || tp->revision == 65))); |
---|
| 16 | + int startup = ! ((tp->chip_id == DC21143 && tp->revision == 65)); |
---|
| 17 | tp->cur_index = i; |
---|
| 18 | tulip_select_media(dev, startup); |
---|
| 19 | setup_done = 1; |
---|
[e89ec63] | 20 | diff -Naur linux-2.6.19.orig/drivers/net/tulip/media.c linux-2.6.19/drivers/net/tulip/media.c |
---|
| 21 | --- linux-2.6.19.orig/drivers/net/tulip/media.c 2006-11-29 13:57:37.000000000 -0800 |
---|
| 22 | +++ linux-2.6.19/drivers/net/tulip/media.c 2006-11-29 19:27:20.000000000 -0800 |
---|
[8bb5996] | 23 | @@ -44,8 +44,10 @@ |
---|
| 24 | |
---|
| 25 | /* MII transceiver control section. |
---|
| 26 | Read and write the MII registers using software-generated serial |
---|
| 27 | - MDIO protocol. See the MII specifications or DP83840A data sheet |
---|
| 28 | - for details. */ |
---|
| 29 | + MDIO protocol. |
---|
| 30 | + See IEEE 802.3-2002.pdf (Section 2, Chapter "22.2.4 Management functions") |
---|
| 31 | + or DP83840A data sheet for more details. |
---|
| 32 | + */ |
---|
| 33 | |
---|
| 34 | int tulip_mdio_read(struct net_device *dev, int phy_id, int location) |
---|
| 35 | { |
---|
| 36 | @@ -261,24 +263,56 @@ |
---|
| 37 | u16 *reset_sequence = &((u16*)(p+3))[init_length]; |
---|
| 38 | int reset_length = p[2 + init_length*2]; |
---|
| 39 | misc_info = reset_sequence + reset_length; |
---|
| 40 | - if (startup) |
---|
| 41 | + if (startup) { |
---|
| 42 | + int timeout = 10; /* max 1 ms */ |
---|
| 43 | for (i = 0; i < reset_length; i++) |
---|
| 44 | iowrite32(get_u16(&reset_sequence[i]) << 16, ioaddr + CSR15); |
---|
| 45 | + |
---|
| 46 | + /* flush posted writes */ |
---|
| 47 | + ioread32(ioaddr + CSR15); |
---|
| 48 | + |
---|
| 49 | + /* Sect 3.10.3 in DP83840A.pdf (p39) */ |
---|
| 50 | + udelay(500); |
---|
| 51 | + |
---|
| 52 | + /* Section 4.2 in DP83840A.pdf (p43) */ |
---|
| 53 | + /* and IEEE 802.3 "22.2.4.1.1 Reset" */ |
---|
| 54 | + while (timeout-- && |
---|
| 55 | + (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET)) |
---|
| 56 | + udelay(100); |
---|
| 57 | + } |
---|
| 58 | for (i = 0; i < init_length; i++) |
---|
| 59 | iowrite32(get_u16(&init_sequence[i]) << 16, ioaddr + CSR15); |
---|
| 60 | + |
---|
| 61 | + ioread32(ioaddr + CSR15); /* flush posted writes */ |
---|
| 62 | } else { |
---|
| 63 | u8 *init_sequence = p + 2; |
---|
| 64 | u8 *reset_sequence = p + 3 + init_length; |
---|
| 65 | int reset_length = p[2 + init_length]; |
---|
| 66 | misc_info = (u16*)(reset_sequence + reset_length); |
---|
| 67 | if (startup) { |
---|
| 68 | + int timeout = 10; /* max 1 ms */ |
---|
| 69 | iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12); |
---|
| 70 | for (i = 0; i < reset_length; i++) |
---|
| 71 | iowrite32(reset_sequence[i], ioaddr + CSR12); |
---|
| 72 | + |
---|
| 73 | + /* flush posted writes */ |
---|
| 74 | + ioread32(ioaddr + CSR12); |
---|
| 75 | + |
---|
| 76 | + /* Sect 3.10.3 in DP83840A.pdf (p39) */ |
---|
| 77 | + udelay(500); |
---|
| 78 | + |
---|
| 79 | + /* Section 4.2 in DP83840A.pdf (p43) */ |
---|
| 80 | + /* and IEEE 802.3 "22.2.4.1.1 Reset" */ |
---|
| 81 | + while (timeout-- && |
---|
| 82 | + (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET)) |
---|
| 83 | + udelay(100); |
---|
| 84 | } |
---|
| 85 | for (i = 0; i < init_length; i++) |
---|
| 86 | iowrite32(init_sequence[i], ioaddr + CSR12); |
---|
| 87 | + |
---|
| 88 | + ioread32(ioaddr + CSR12); /* flush posted writes */ |
---|
| 89 | } |
---|
| 90 | + |
---|
| 91 | tmp_info = get_u16(&misc_info[1]); |
---|
| 92 | if (tmp_info) |
---|
| 93 | tp->advertising[phy_num] = tmp_info | 1; |
---|
[e89ec63] | 94 | diff -Naur linux-2.6.19.orig/drivers/net/tulip/tulip.h linux-2.6.19/drivers/net/tulip/tulip.h |
---|
| 95 | --- linux-2.6.19.orig/drivers/net/tulip/tulip.h 2006-11-29 13:57:37.000000000 -0800 |
---|
| 96 | +++ linux-2.6.19/drivers/net/tulip/tulip.h 2006-11-29 19:27:20.000000000 -0800 |
---|
| 97 | @@ -481,8 +481,11 @@ |
---|
[8bb5996] | 98 | udelay(10); |
---|
| 99 | |
---|
| 100 | if (!i) |
---|
| 101 | - printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed\n", |
---|
| 102 | - pci_name(tp->pdev)); |
---|
| 103 | + printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed" |
---|
| 104 | + " (CSR5 0x%x CSR6 0x%x)\n", |
---|
| 105 | + pci_name(tp->pdev), |
---|
| 106 | + ioread32(ioaddr + CSR5), |
---|
| 107 | + ioread32(ioaddr + CSR6)); |
---|
| 108 | } |
---|
| 109 | } |
---|
| 110 | |
---|
[e89ec63] | 111 | diff -Naur linux-2.6.19.orig/drivers/net/tulip/tulip_core.c linux-2.6.19/drivers/net/tulip/tulip_core.c |
---|
| 112 | --- linux-2.6.19.orig/drivers/net/tulip/tulip_core.c 2006-11-29 13:57:37.000000000 -0800 |
---|
| 113 | +++ linux-2.6.19/drivers/net/tulip/tulip_core.c 2006-11-29 19:27:20.000000000 -0800 |
---|
| 114 | @@ -21,7 +21,7 @@ |
---|
[8bb5996] | 115 | #else |
---|
[e89ec63] | 116 | #define DRV_VERSION "1.1.14" |
---|
[8bb5996] | 117 | #endif |
---|
| 118 | -#define DRV_RELDATE "May 11, 2002" |
---|
| 119 | +#define DRV_RELDATE "December 15, 2004" |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | #include <linux/module.h> |
---|
[e89ec63] | 123 | |
---|