I pull the lastest ng code from svn and did cross-compile:
/usr/local/bin/arm-linux-gcc -D__KERNEL__ -I/home/bcheng/snapgear/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX _ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -mshort-load-bytes -msoft-float -Uarm -DMODULE -include ./../include/compat.h -I./../include -I./../hal -I./../hal/linux -I./../ath_hal -I./.. -Werror -DAH_BYTE_ORDER=AH_BIG_ENDIAN -DAH_REGOPS_FUNC -mbig-endian -fno-strict-aliasing -fno-common -mapcs-32 -mtune=xscale -mshort-load-bytes -msoft-float -mfp=2 -DATH_SUPERG_FF=1 -DATH_SUPERG_DYNTURBO=1 -DATH_TURBO_SCAN=1 -DATH_SUPERG_XR=1 -nostdinc -iwithprefix include -DKBUILD_BASENAME=ah_osdep -DEXPORT_SYMTAB -c ah_osdep.ccc1: warnings being treated as errors
ah_osdep.c: In function `ath_hal_reg_write':
ah_osdep.c:330: warning: passing arg 2 of `__writel' makes integer from pointer without a cast
ah_osdep.c:330: warning: passing arg 2 of `__writel' makes integer from pointer without a cast
ah_osdep.c: In function `ath_hal_reg_read':
ah_osdep.c:339: warning: passing arg 1 of `__readl' makes integer from pointer without a cast
ah_osdep.c:339: warning: passing arg 1 of `__readl' makes integer from pointer without a cast
make[3]: *** [ah_osdep.o] Error 1
make[3]: Leaving directory `/home/bcheng/snapgear/madwifi-ng/ath_hal'
The errors are from ../hal/linux/ah_osdep.h
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
if ( (_reg) >= 0x4000 && (_reg) < 0x5000) \
writel((_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg)));\
else \
writel(__bswap32(_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg))); \
} while (0)
I fixed Error by adding a typecast (u32) to
writel((_val), (volatile u_int32_t *)((_ah)->ah_sh + (_reg)));\
But later I received "unable to attach hardware - HAL status 13" error
# insmod wlan.o
Using wlan.o
wlan: 0.8.4.2 (Atheros/multi-bss)
# insmod ath_hal.o
Using ath_hal.o
Warning: loading ath_hal will taint the kernel: non-GPL license - Proprietary
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
ath_hal: 0.9.16.13 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, REGOPS_FUNC, DFS)
# insmod ath_rate_sample.o
Using ath_rate_sample.o
ath_rate_sample: 1.2
# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi%d: unable to attach hardware: 'Hardware revision not supported' (HAL status 13)
Then I looked at the ../hal/linux/ah_osdep.h from /!svn/ver/1394/trunk
It has a different definition. there is no ( *) pointer typecast
in writel() and readl()
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
if ( (_reg) >= 0x4000 && (_reg) < 0x5000) \
writel((_val), (volatile unsigned long)((_ah)->ah_sh + (_reg)));\
else \
writel(__bswap32(_val), (volatile unsigned long)((_ah)->ah_sh + (_reg))); \
} while (0)
I used this definition and didn't see any compilation error
but I received the same error from insmod ath_pci.o
# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi%d: unable to attach hardware: 'Hardware revision not supported' (HAL status 13)
However, the madwifi-ng from /!svn/ver/1349/trunk works fine
on my ixp425-based board. No compilation error, no (HAL status 13) error
I'm running linux 2.4.24, using XSCALE processor with big-endian configuration.
I looked at the ../hal/linux/ah_osdep.h file, there is no
writel() in _OS_REG_WRITE()
I'm confused, ah_osdep.h constantly been changing.
#if AH_BYTE_ORDER == AH_BIG_ENDIAN
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
if ( (_reg) >= 0x4000 && (_reg) < 0x5000) \
*((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = \
__bswap32((_val)); \
else \
*((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \
} while (0)
#define _OS_REG_READ(_ah, _reg) \
(((_reg) >= 0x4000 && (_reg) < 0x5000) ? \
__bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \
*((volatile u_int32_t *)((_ah)->ah_sh + (_reg))))
#else /* AH_LITTLE_ENDIAN */
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
*((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \
} while (0)
#define _OS_REG_READ(_ah, _reg) \
*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))
#endif /* AH_BYTE_ORDER */
# insmod wlan.o
Using wlan.o
wlan: 0.8.4.2 (Atheros/multi-bss)
# insmod ath_hal.o
Using ath_hal.o
Warning: loading ath_hal will taint the kernel: non-GPL license - Proprietary
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
ath_hal: 0.9.16.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, REGOPS_FUNC, DFS)
# insmod ath_rate_sample.o
Using ath_rate_sample.o
ath_rate_sample: 1.2
# insmod wlan_scan_sta.o
Using wlan_scan_sta.o
# insmod ath_pci.o
Using ath_pci.o
ath_pci: 0.9.4.5 (Atheros/multi-bss)
wifi0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbpswifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 5.9 phy 4.3 radio 3.6
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 5212: mem=0x4bff0000, irq=28