1 Index: madwifi-trunk-r3314/ath_hal/ah_os.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath_hal/ah_os.c 2008-07-06 02:42:52.000000000 +0200
4 +++ madwifi-trunk-r3314/ath_hal/ah_os.c 2008-07-06 02:51:53.000000000 +0200
6 * NB: see the comments in ah_osdep.h about byte-swapping register
7 * reads and writes to understand what's going on below.
10 +#ifdef CONFIG_IFXMIPS
11 +extern int ifxmips_has_brn_block(void);
12 +static int ifxmips_emulate = 0;
13 +#define EEPROM_EMULATION 1
16 +#ifdef EEPROM_EMULATION
17 +static int ath_hal_eeprom(struct ath_hal *ah, unsigned long addr, int val, int write)
19 + static int addrsel = 0;
23 + if(addr == 0x6000) {
37 + val = cpu_to_le16(__raw_readw((u16 *) KSEG1ADDR(0xb07f0400 + addrsel)));
38 + /* this forces the regdomain to 0x00 (worldwide), as the original setting
39 + * causes issues with the HAL */
40 + if (addrsel == 0x17e)
50 ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val)
53 ath_hal_printf(ah, "%s: WRITE 0x%x <= 0x%x\n",
54 (ath_hal_func ?: "unknown"), reg, val);
56 - _OS_REG_WRITE(ah, reg, val);
57 +#ifdef EEPROM_EMULATION
58 + if((reg >= 0x6000) && (reg <= 0x6010) && ifxmips_emulate)
60 + val = ath_hal_eeprom(ah, reg, val, 1);
63 + _OS_REG_WRITE(ah, reg, val);
65 EXPORT_SYMBOL(ath_hal_reg_write);
68 /* This should only be called while holding the lock, sc->sc_hal_lock. */
70 ath_hal_reg_read(struct ath_hal *ah, u_int reg)
74 +#ifdef EEPROM_EMULATION
75 + if((reg >= 0x6000) && (reg <= 0x6010) && ifxmips_emulate)
77 + val = ath_hal_eeprom(ah, reg, 0, 0);
80 + val = _OS_REG_READ(ah, reg);
82 - val = _OS_REG_READ(ah, reg);
84 if (ath_hal_debug > 1)
85 - ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
86 + ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
87 (ath_hal_func ?: "unknown"), reg, val);
95 +#ifdef CONFIG_IFXMIPS
96 + ifxmips_emulate = ifxmips_has_brn_block();
98 printk(KERN_INFO "%s: %s (", dev_info, ath_hal_version);
100 for (i = 0; ath_hal_buildopts[i] != NULL; i++) {