feebf3f56aca9d6fadc0fc9ba17f36244b3bc29e
[librecmc/librecmc.git] / package / madwifi / patches / 120-soc_fix.patch
1 diff -urN madwifi-ng-r2377-20070526.old/ath/if_ath_ahb.c madwifi-ng-r2377-20070526.dev/ath/if_ath_ahb.c
2 --- madwifi-ng-r2377-20070526.old/ath/if_ath_ahb.c      2007-02-24 02:33:54.000000000 +0100
3 +++ madwifi-ng-r2377-20070526.dev/ath/if_ath_ahb.c      2007-05-26 18:51:09.112702200 +0200
4 @@ -275,11 +275,10 @@
5  
6  
7  static int
8 -exit_ath_wmac(u_int16_t wlanNum)
9 +exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
10  {
11         struct ath_ahb_softc *sc = sclist[wlanNum];
12         struct net_device *dev;
13 -       const char *sysType;
14         u_int16_t devid;
15  
16         if (sc == NULL)
17 @@ -290,12 +289,16 @@
18         if (dev->irq)
19                 free_irq(dev->irq, dev);
20         sysType = get_system_type();
21 -       if (!strcmp(sysType, "Atheros AR5315"))
22 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
23 +       devid = (u32) config->tag;
24 +#else
25 +       if (!strcmp(get_system_type(), "Atheros AR5315"))
26                 devid = (u_int16_t) (sysRegRead(AR5315_SREV) &
27                         (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
28         else
29                 devid = (u_int16_t) ((sysRegRead(AR531X_REV) >> 8) &
30                         (AR531X_REV_MAJ | AR531X_REV_MIN));
31 +#endif
32  
33         ahb_disable_wmac(devid, wlanNum);
34         free_netdev(dev);
35 @@ -401,7 +404,7 @@
36  
37  static int ahb_wmac_remove(struct platform_device *pdev)
38  {
39 -       exit_ath_wmac(pdev->id);
40 +       exit_ath_wmac(pdev->id, (struct ar531x_config *) pdev->dev.platform_data);
41  
42         return 0;
43  }
44 @@ -439,7 +442,7 @@
45                         (AR5315_REV_MAJ_M | AR5315_REV_MIN_M));
46                 if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
47                         ((devid & AR5315_REV_MAJ_M) == AR5317_REV_MAJ))
48 -                       return init_ath_wmac(devid, 0, &config);
49 +                       return init_ath_wmac(devid, 0);
50         }
51  
52         devid = (u_int16_t) ((sysRegRead(AR531X_REV) >>8) &
53 @@ -452,11 +455,11 @@
54                 ar5312BspEepromRead(2 * AR531X_RADIO_MASK_OFF, 2,
55                         (char *) &radioMask);
56                 if ((radioMask & AR531X_RADIO0_MASK) != 0)
57 -                       if ((ret = init_ath_wmac(devid, 0, &config)) !=0 )
58 +                       if ((ret = init_ath_wmac(devid, 0)) !=0 )
59                                 return ret;
60                 /* XXX: Fall through?! */
61         case AR5212_AR2313_REV8:
62 -               if ((ret = init_ath_wmac(devid, 1, &config)) != 0)
63 +               if ((ret = init_ath_wmac(devid, 1)) != 0)
64                         return ret;
65                 break;
66         default: