4 * NB: see the comments in ah_osdep.h about byte-swapping register
5 * reads and writes to understand what's going on below.
9 +extern int lantiq_emulate_madwifi_eep;
10 +#define EEPROM_EMULATION 1
13 +#ifdef EEPROM_EMULATION
14 +static int ath_hal_eeprom(struct ath_hal *ah, unsigned long addr, int val, int write)
16 + static int addrsel = 0;
20 + if(addr == 0x6000) {
34 + val = cpu_to_le16(__raw_readw((u16 *) KSEG1ADDR(0xb07f0400 + addrsel)));
35 + /* this forces the regdomain to 0x00 (worldwide), as the original setting
36 + * causes issues with the HAL */
37 + if (addrsel == 0x17e)
47 ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val)
50 ath_hal_printf(ah, "%s: WRITE 0x%x <= 0x%x\n",
51 (ath_hal_func ?: "unknown"), reg, val);
53 - _OS_REG_WRITE(ah, reg, val);
54 +#ifdef EEPROM_EMULATION
55 + if((reg >= 0x6000) && (reg <= 0x6010) && lantiq_emulate_madwifi_eep)
57 + val = ath_hal_eeprom(ah, reg, val, 1);
60 + _OS_REG_WRITE(ah, reg, val);
62 EXPORT_SYMBOL(ath_hal_reg_write);
65 /* This should only be called while holding the lock, sc->sc_hal_lock. */
67 ath_hal_reg_read(struct ath_hal *ah, u_int reg)
71 +#ifdef EEPROM_EMULATION
72 + if((reg >= 0x6000) && (reg <= 0x6010) && lantiq_emulate_madwifi_eep)
74 + val = ath_hal_eeprom(ah, reg, 0, 0);
77 + val = _OS_REG_READ(ah, reg);
79 - val = _OS_REG_READ(ah, reg);
81 if (ath_hal_debug > 1)
82 - ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
83 + ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
84 (ath_hal_func ?: "unknown"), reg, val);
92 printk(KERN_INFO "%s: %s (", dev_info, ath_hal_version);
94 for (i = 0; ath_hal_buildopts[i] != NULL; i++) {