ddf41645341ae70168546a3efaf19c3c6703c628
[openwrt.git] / target / linux / brcm-2.4 / patches / 008-b44_bcm47xx_support.patch
1 --- linux-2.4.32.old/drivers/net/b44.c 2006-01-11 04:41:11.175458750 +0100
2 +++ linux-2.4.32/drivers/net/b44.c 2006-01-11 20:19:57.900822500 +0100
3 @@ -3,6 +3,7 @@
4 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
5 * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi)
6 * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
7 + * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org)
8 *
9 * Distribute under GPL.
10 */
11 @@ -36,6 +37,31 @@
12 #include <sbchipc.h>
13 #include <sflash.h>
14
15 +#ifdef CONFIG_BCM947XX
16 +#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0)
17 +
18 +static inline void e_aton(char *str, char *dest)
19 +{
20 + int i = 0;
21 + u16 *d = (u16 *) dest;
22 +
23 + if (str == NULL) {
24 + memset(dest, 0, 6);
25 + return;
26 + }
27 +
28 + for (;;) {
29 + dest[i++] = (char) simple_strtoul(str, NULL, 16);
30 + str += 2;
31 + if (!*str++ || i == 6)
32 + break;
33 + }
34 +}
35 +
36 +static int instance = 0;
37 +#endif
38 +
39 +
40 #define DRV_MODULE_NAME "b44"
41 #define PFX DRV_MODULE_NAME ": "
42 #define DRV_MODULE_VERSION "0.93"
43 @@ -285,7 +311,7 @@
44 == SBTMSLOW_CLOCK);
45 }
46
47 -static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
48 +static inline void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
49 {
50 u32 val;
51
52 @@ -1751,10 +1777,18 @@
53 static int __devinit b44_get_invariants(struct b44 *bp)
54 {
55 u8 eeprom[128];
56 + u8 buf[32];
57 int err;
58 unsigned long flags;
59
60 if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
61 +#ifdef CONFIG_BCM947XX
62 + sprintf(buf, "et%dmacaddr", instance - 1);
63 + e_aton(nvram_get(buf), bp->dev->dev_addr);
64 +
65 + sprintf(buf, "et%dphyaddr", instance - 1);
66 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
67 +#else
68 /*
69 * BCM47xx boards don't have a EEPROM. The MAC is stored in
70 * a NVRAM area somewhere in the flash memory. As we don't
71 @@ -1771,6 +1805,7 @@
72 * chip with multiple PHYs connected to the PHY port.
73 */
74 bp->phy_addr = B44_PHY_ADDR_NO_PHY;
75 +#endif
76 bp->dma_offset = 0;
77 } else {
78 err = b44_read_eeprom(bp, &eeprom[0]);
79 @@ -1814,6 +1849,10 @@
80 struct b44 *bp;
81 int err, i;
82
83 +#ifdef CONFIG_BCM947XX
84 + instance++;
85 +#endif
86 +
87 if (b44_version_printed++ == 0)
88 printk(KERN_INFO "%s", version);
89
This page took 0.04646 seconds and 3 git commands to generate.