3 @@ -343,6 +343,46 @@ EXPORT_SYMBOL(ath_hal_func);
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 ifxmips_has_brn_block(void);
10 +static int ifxmips_emulate = 0;
11 +#define EEPROM_EMULATION 1
14 +#ifdef EEPROM_EMULATION
15 +static int ath_hal_eeprom(struct ath_hal *ah, unsigned long addr, int val, int write)
17 + static int addrsel = 0;
21 + if(addr == 0x6000) {
35 + val = cpu_to_le16(__raw_readw((u16 *) KSEG1ADDR(0xb07f0400 + addrsel)));
36 + /* this forces the regdomain to 0x00 (worldwide), as the original setting
37 + * causes issues with the HAL */
38 + if (addrsel == 0x17e)
48 ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val)
50 @@ -351,20 +391,33 @@ ath_hal_reg_write(struct ath_hal *ah, u_
51 ath_hal_printf(ah, "%s: WRITE 0x%x <= 0x%x\n",
52 (ath_hal_func ?: "unknown"), reg, val);
54 - _OS_REG_WRITE(ah, reg, val);
55 +#ifdef EEPROM_EMULATION
56 + if((reg >= 0x6000) && (reg <= 0x6010) && ifxmips_emulate)
58 + val = ath_hal_eeprom(ah, reg, val, 1);
61 + _OS_REG_WRITE(ah, reg, val);
63 EXPORT_SYMBOL(ath_hal_reg_write);
66 /* This should only be called while holding the lock, sc->sc_hal_lock. */
68 ath_hal_reg_read(struct ath_hal *ah, u_int reg)
72 +#ifdef EEPROM_EMULATION
73 + if((reg >= 0x6000) && (reg <= 0x6010) && ifxmips_emulate)
75 + val = ath_hal_eeprom(ah, reg, 0, 0);
78 + val = _OS_REG_READ(ah, reg);
80 - val = _OS_REG_READ(ah, reg);
82 if (ath_hal_debug > 1)
83 - ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
84 + ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
85 (ath_hal_func ?: "unknown"), reg, val);
88 @@ -581,7 +634,9 @@ init_ath_hal(void)
93 +#ifdef CONFIG_IFXMIPS
94 + ifxmips_emulate = ifxmips_has_brn_block();
96 printk(KERN_INFO "%s: %s (", dev_info, ath_hal_version);
98 for (i = 0; ath_hal_buildopts[i] != NULL; i++) {