[kernel] remove 2.6.24, no target is relying on it
[openwrt.git] / target / linux / rdc / patches-2.6.28 / 007-r6040_git_updates.patch
1 --- linux-2.6.28.9/drivers/net/r6040.c 2009-03-23 22:55:52.000000000 +0100
2 +++ linux-2.6.28.9.new/drivers/net/r6040.c 2009-04-24 14:24:51.000000000 +0200
3 @@ -49,12 +49,12 @@
4 #include <asm/processor.h>
5
6 #define DRV_NAME "r6040"
7 -#define DRV_VERSION "0.19"
8 -#define DRV_RELDATE "18Dec2008"
9 +#define DRV_VERSION "0.22"
10 +#define DRV_RELDATE "25Mar2009"
11
12 /* PHY CHIP Address */
13 #define PHY1_ADDR 1 /* For MAC1 */
14 -#define PHY2_ADDR 2 /* For MAC2 */
15 +#define PHY2_ADDR 3 /* For MAC2 */
16 #define PHY_MODE 0x3100 /* PHY CHIP Register 0 */
17 #define PHY_CAP 0x01E1 /* PHY CHIP Register 4 */
18
19 @@ -160,6 +160,7 @@
20 "Florian Fainelli <florian@openwrt.org>");
21 MODULE_LICENSE("GPL");
22 MODULE_DESCRIPTION("RDC R6040 NAPI PCI FastEthernet driver");
23 +MODULE_VERSION(DRV_VERSION " " DRV_RELDATE);
24
25 /* RX and TX interrupts that we handle */
26 #define RX_INTS (RX_FIFO_FULL | RX_NO_DESC | RX_FINISH)
27 @@ -200,7 +201,7 @@
28
29 static char version[] __devinitdata = KERN_INFO DRV_NAME
30 ": RDC R6040 NAPI net driver,"
31 - "version "DRV_VERSION " (" DRV_RELDATE ")\n";
32 + "version "DRV_VERSION " (" DRV_RELDATE ")";
33
34 static int phy_table[] = { PHY1_ADDR, PHY2_ADDR };
35
36 @@ -330,7 +331,7 @@
37 do {
38 skb = netdev_alloc_skb(dev, MAX_BUF_SIZE);
39 if (!skb) {
40 - printk(KERN_ERR "%s: failed to alloc skb for rx\n", dev->name);
41 + printk(KERN_ERR DRV_NAME "%s: failed to alloc skb for rx\n", dev->name);
42 rc = -ENOMEM;
43 goto err_exit;
44 }
45 @@ -438,7 +439,6 @@
46 {
47 struct r6040_private *lp = netdev_priv(dev);
48 void __iomem *ioaddr = lp->base;
49 - struct pci_dev *pdev = lp->pdev;
50 int limit = 2048;
51 u16 *adrp;
52 u16 cmd;
53 @@ -457,22 +457,12 @@
54 iowrite16(adrp[0], ioaddr + MID_0L);
55 iowrite16(adrp[1], ioaddr + MID_0M);
56 iowrite16(adrp[2], ioaddr + MID_0H);
57 - free_irq(dev->irq, dev);
58 -
59 - /* Free RX buffer */
60 - r6040_free_rxbufs(dev);
61 -
62 - /* Free TX buffer */
63 - r6040_free_txbufs(dev);
64 -
65 - /* Free Descriptor memory */
66 - pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
67 - pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
68 }
69
70 static int r6040_close(struct net_device *dev)
71 {
72 struct r6040_private *lp = netdev_priv(dev);
73 + struct pci_dev *pdev = lp->pdev;
74
75 /* deleted timer */
76 del_timer_sync(&lp->timer);
77 @@ -481,8 +471,28 @@
78 napi_disable(&lp->napi);
79 netif_stop_queue(dev);
80 r6040_down(dev);
81 +
82 + free_irq(dev->irq, dev);
83 +
84 + /* Free RX buffer */
85 + r6040_free_rxbufs(dev);
86 +
87 + /* Free TX buffer */
88 + r6040_free_txbufs(dev);
89 +
90 spin_unlock_irq(&lp->lock);
91
92 + /* Free Descriptor memory */
93 + if (lp->rx_ring) {
94 + pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
95 + lp->rx_ring = NULL;
96 + }
97 +
98 + if (lp->tx_ring) {
99 + pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
100 + lp->tx_ring = NULL;
101 + }
102 +
103 return 0;
104 }
105
106 @@ -598,7 +608,6 @@
107
108 /* Send to upper layer */
109 netif_receive_skb(skb_ptr);
110 - dev->last_rx = jiffies;
111 dev->stats.rx_packets++;
112 dev->stats.rx_bytes += descptr->len - 4;
113
114 @@ -668,7 +677,7 @@
115 work_done = r6040_rx(dev, budget);
116
117 if (work_done < budget) {
118 - netif_rx_complete(dev, napi);
119 + napi_complete(napi);
120 /* Enable RX interrupt */
121 iowrite16(ioread16(ioaddr + MIER) | RX_INTS, ioaddr + MIER);
122 }
123 @@ -705,7 +714,7 @@
124
125 /* Mask off RX interrupt */
126 misr &= ~RX_INTS;
127 - netif_rx_schedule(dev, &lp->napi);
128 + napi_schedule(&lp->napi);
129 }
130
131 /* TX interrupt request */
132 @@ -1063,20 +1088,20 @@
133 /* this should always be supported */
134 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
135 if (err) {
136 - printk(KERN_ERR DRV_NAME "32-bit PCI DMA addresses"
137 + printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses"
138 "not supported by the card\n");
139 goto err_out;
140 }
141 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
142 if (err) {
143 - printk(KERN_ERR DRV_NAME "32-bit PCI DMA addresses"
144 + printk(KERN_ERR DRV_NAME ": 32-bit PCI DMA addresses"
145 "not supported by the card\n");
146 goto err_out;
147 }
148
149 /* IO Size check */
150 if (pci_resource_len(pdev, 0) < io_size) {
151 - printk(KERN_ERR DRV_NAME "Insufficient PCI resources, aborting\n");
152 + printk(KERN_ERR DRV_NAME ": Insufficient PCI resources, aborting\n");
153 err = -EIO;
154 goto err_out;
155 }
156 @@ -1086,7 +1111,7 @@
157
158 dev = alloc_etherdev(sizeof(struct r6040_private));
159 if (!dev) {
160 - printk(KERN_ERR DRV_NAME "Failed to allocate etherdev\n");
161 + printk(KERN_ERR DRV_NAME ": Failed to allocate etherdev\n");
162 err = -ENOMEM;
163 goto err_out;
164 }
165 @@ -1102,11 +1127,15 @@
166
167 ioaddr = pci_iomap(pdev, bar, io_size);
168 if (!ioaddr) {
169 - printk(KERN_ERR "ioremap failed for device %s\n",
170 + printk(KERN_ERR DRV_NAME ": ioremap failed for device %s\n",
171 pci_name(pdev));
172 err = -EIO;
173 goto err_out_free_res;
174 }
175 + /* If PHY status change register is still set to zero it means the
176 + * bootloader didn't initialize it */
177 + if (ioread16(ioaddr + PHY_CC) == 0)
178 + iowrite16(0x9f07, ioaddr + PHY_CC);
179
180 /* Init system & device */
181 lp->base = ioaddr;
182 @@ -1123,6 +1152,13 @@
183 adrp[1] = ioread16(ioaddr + MID_0M);
184 adrp[2] = ioread16(ioaddr + MID_0H);
185
186 + /* Some bootloader/BIOSes do not initialize
187 + * MAC address, warn about that */
188 + if (!(adrp[0] || adrp[1] || adrp[2])) {
189 + printk(KERN_WARNING DRV_NAME ": MAC address not initialized, generating random\n");
190 + random_ether_addr(dev->dev_addr);
191 + }
192 +
193 /* Link new device into r6040_root_dev */
194 lp->pdev = pdev;
195 lp->dev = dev;
This page took 0.05534 seconds and 5 git commands to generate.