openwrt ar71xx wifi初始化依赖art分区

7780阅读 0评论2015-03-13 polejo
分类:LINUX

openwrt中负责无线驱动的主要是ath9k.ko mac80211.ko cfg80211.ko
正常的调用路径是
ath_ahb_probe()                             -- ath9k
ieee80211_alloc_hw()                      -- mac80211
wiphy_new()                                   -- cfg80211   
 dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
以在sysfs创建出 /sys/class/ieee80211/phy0/

发现ar71xx openwrt镜像在个别板子上无线网络失败。有如下错误
[   10.590000] ath: phy0: Unable to initialize hardware; initialization status: -5
[   10.600000] ath9k ar934x_wmac: failed to initialize device
[   10.610000] ath9k: probe of ar934x_wmac failed with error -5
出现这个错误时,/sys/class/ieee80211/下不会创建wifi设备。

一番打印用时方恨少!得到出错的调用路径是 
  1. ath_ahb_probe()
  2. ath9k_init_device()
  3. ath9k_init_softc()
  4. ath9k_hw_init() __ath9k_hw_init()
  5. ath9k_hw_post_init()
  6. ath9k_hw_eeprom_init()
  7. eep_ar9300_ops->fill_eeprom = ath9k_hw_ar9300_fill_eeprom()
  8. ar9300_eeprom_restore_internal()

从flash中取出eeprom配置,并验证是否有效。
  1. if (ath9k_hw_use_flash(ah)) {
  2.     u8 txrx;
  3.     ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
  4.     /* check if eeprom contains valid data */
  5.     eep = (struct ar9300_eeprom *) mptr;
  6.     txrx = eep->baseEepHeader.txrxMask;
  7.     printk(KERN_EMERG" @@@@@@@ %s-%d, txrx 0x%x \n", __FUNCTION__, __LINE__, txrx);
  8.     if (txrx != 0 && txrx != 0xff)
  9.         return 0;
  10. }

确认原因是art分区没有合法的参数,从好板子上那一份正确的art分区
cat /dev/mtd4 > /tmp/ar71xx-art.bin
mtd write ar71xx-art.bin art -r

因为有的板子上art分区是在用flash烧写器整片擦除时破坏掉了,导致了此问题。
见识到atheros传说中的art威力,以前一直认为art就是优化无线参数,有没有都不该影响初始化啊。

上一篇:openwrt atheros系列wifi失败,Cannot assign requested address 问题
下一篇:一份通用的用户态Makefile