2 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 static void ax88796_bitset(u32 bit)
42 static u8 ax88796_bitget(void)
57 * Send COMMAND to EEPROM
59 static void ax88796_eep_cmd(u8 cmd)
61 ax88796_bitset(BIT_DUMMY);
97 static void ax88796_eep_setaddr(u16 addr)
101 for( i = 7 ; i >= 0 ; i-- )
102 ax88796_bitset(addr & (1 << i));
106 * Get data from EEPROM
108 static u16 ax88796_eep_getdata(void)
113 ax88796_bitget(); /* DUMMY */
114 for( i = 0 ; i < 16 ; i++ ){
116 data |= ax88796_bitget();
121 static void ax88796_mac_read(u8 *buff)
127 for( i = 0 ; i < 3; i++ )
133 ax88796_eep_cmd(MAC_EEP_READ);
135 ax88796_eep_setaddr(addr++);
137 data = ax88796_eep_getdata();
138 *buff++ = (uchar)(data & 0xff);
139 *buff++ = (uchar)((data >> 8) & 0xff);
146 int get_prom(u8* mac_addr)
151 ax88796_mac_read(prom);
152 for (i = 0; i < 6; i++){
153 mac_addr[i] = prom[i];