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