[adm5120] more generic handling of Macronix flash chips, fix #2008
[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