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 address, u_int32_t value)
50 +#ifdef EEPROM_EMULATION
51 + if((address >= 0x6000) && (address <= 0x6010) && ifxmips_emulate) {
52 + ath_hal_eeprom(ah, address, value, 1);
57 _trace_regop(ah, REGOP_WRITE, address, value);
58 _OS_REG_WRITE(ah, address, value);
62 ath_hal_reg_read(struct ath_hal *ah, u_int address)
64 - u_int32_t val = _OS_REG_READ(ah, address);
67 +#ifdef EEPROM_EMULATION
68 + if((address >= 0x6000) && (address <= 0x6010) && ifxmips_emulate)
69 + val = ath_hal_eeprom(ah, address, 0, 0);
72 + val = _OS_REG_READ(ah, address);
73 _trace_regop(ah, REGOP_READ, address, val);
78 kmmio_logmsg = _kmmio_logmsg;
80 +#ifdef CONFIG_IFXMIPS
81 + ifxmips_emulate = ifxmips_has_brn_block();
85 for (i = 0; ath_hal_buildopts[i] != NULL; i++) {