2 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 * SPDX-License-Identifier: GPL-2.0+
12 static void ax88796_bitset(u32 bit)
30 static u8 ax88796_bitget(void)
45 * Send COMMAND to EEPROM
47 static void ax88796_eep_cmd(u8 cmd)
49 ax88796_bitset(BIT_DUMMY);
85 static void ax88796_eep_setaddr(u16 addr)
89 for( i = 7 ; i >= 0 ; i-- )
90 ax88796_bitset(addr & (1 << i));
94 * Get data from EEPROM
96 static u16 ax88796_eep_getdata(void)
101 ax88796_bitget(); /* DUMMY */
102 for( i = 0 ; i < 16 ; i++ ){
104 data |= ax88796_bitget();
109 static void ax88796_mac_read(u8 *buff)
115 for( i = 0 ; i < 3; i++ )
121 ax88796_eep_cmd(MAC_EEP_READ);
123 ax88796_eep_setaddr(addr++);
125 data = ax88796_eep_getdata();
126 *buff++ = (uchar)(data & 0xff);
127 *buff++ = (uchar)((data >> 8) & 0xff);
134 int get_prom(u8* mac_addr, u8* base_addr)
139 ax88796_mac_read(prom);
140 for (i = 0; i < 6; i++){
141 mac_addr[i] = prom[i];