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