1 // SPDX-License-Identifier: GPL-2.0+
3 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
11 static void ax88796_bitset(u32 bit)
29 static u8 ax88796_bitget(void)
44 * Send COMMAND to EEPROM
46 static void ax88796_eep_cmd(u8 cmd)
48 ax88796_bitset(BIT_DUMMY);
84 static void ax88796_eep_setaddr(u16 addr)
88 for( i = 7 ; i >= 0 ; i-- )
89 ax88796_bitset(addr & (1 << i));
93 * Get data from EEPROM
95 static u16 ax88796_eep_getdata(void)
100 ax88796_bitget(); /* DUMMY */
101 for( i = 0 ; i < 16 ; i++ ){
103 data |= ax88796_bitget();
108 static void ax88796_mac_read(u8 *buff)
114 for( i = 0 ; i < 3; i++ )
120 ax88796_eep_cmd(MAC_EEP_READ);
122 ax88796_eep_setaddr(addr++);
124 data = ax88796_eep_getdata();
125 *buff++ = (uchar)(data & 0xff);
126 *buff++ = (uchar)((data >> 8) & 0xff);
133 int get_prom(u8* mac_addr, u8* base_addr)
138 ax88796_mac_read(prom);
139 for (i = 0; i < 6; i++){
140 mac_addr[i] = prom[i];