Lines Matching refs:eeprom
100 static struct eeprom_type eeprom; variable
116 mutex_init(&eeprom.lock); in eeprom_init()
141 eeprom.size = 0; in eeprom_init()
142 eeprom.usec_delay_writecycles = INITIAL_WRITEDELAY_US; in eeprom_init()
143 eeprom.usec_delay_step = 128; in eeprom_init()
144 eeprom.adapt_state = 0; in eeprom_init()
171 eeprom.size = EEPROM_2KB; in eeprom_init()
172 eeprom.select_cmd = 0xA0; in eeprom_init()
173 eeprom.sequential_write_pagesize = 16; in eeprom_init()
184 eeprom.size = EEPROM_16KB; in eeprom_init()
185 eeprom.select_cmd = 0xA0; in eeprom_init()
186 eeprom.sequential_write_pagesize = 64; in eeprom_init()
201 eeprom.size = EEPROM_16KB; in eeprom_init()
239 eeprom.size = EEPROM_2KB; in eeprom_init()
240 eeprom.select_cmd = 0xA0; in eeprom_init()
241 eeprom.sequential_write_pagesize = 16; in eeprom_init()
251 eeprom.size = EEPROM_2KB; in eeprom_init()
278 eeprom.size = EEPROM_2KB; in eeprom_init()
297 eeprom.size = EEPROM_16KB; in eeprom_init()
307 eeprom.size = EEPROM_2KB; in eeprom_init()
318 eeprom.size = EEPROM_2KB; in eeprom_init()
326 eeprom.size = EEPROM_2KB; in eeprom_init()
332 eeprom.size = EEPROM_8KB; in eeprom_init()
338 eeprom.size = EEPROM_16KB; in eeprom_init()
340 eeprom.size = EEPROM_8KB; in eeprom_init()
342 eeprom.size = EEPROM_2KB; in eeprom_init()
345 switch(eeprom.size) in eeprom_init()
349 eeprom.sequential_write_pagesize = 16; in eeprom_init()
350 eeprom.select_cmd = 0xA0; in eeprom_init()
354 eeprom.sequential_write_pagesize = 16; in eeprom_init()
355 eeprom.select_cmd = 0x80; in eeprom_init()
359 eeprom.sequential_write_pagesize = 64; in eeprom_init()
360 eeprom.select_cmd = 0xA0; in eeprom_init()
363 eeprom.size = 0; in eeprom_init()
383 if( eeprom.size > 0 ) in eeprom_open()
412 file->f_pos = eeprom.size - offset; in eeprom_lseek()
425 if (file->f_pos >= eeprom.size) in eeprom_lseek()
427 file->f_pos = eeprom.size - 1; in eeprom_lseek()
452 if(p >= eeprom.size) /* Address i 0 - (size-1) */ in eeprom_read()
457 if (mutex_lock_interruptible(&eeprom.lock)) in eeprom_read()
469 mutex_unlock(&eeprom.lock); in eeprom_read()
473 if( (p + count) > eeprom.size) in eeprom_read()
476 count = eeprom.size - p; in eeprom_read()
483 if(eeprom.size < EEPROM_16KB) in eeprom_read()
485 i2c_outbyte( eeprom.select_cmd | 1 | (page << 1) ); in eeprom_read()
496 mutex_unlock(&eeprom.lock); in eeprom_read()
522 if (mutex_lock_interruptible(&eeprom.lock)) in eeprom_write()
531 while( (written < count) && (p < eeprom.size)) in eeprom_write()
541 mutex_unlock(&eeprom.lock); in eeprom_write()
546 if (eeprom.retry_cnt_addr > 0) in eeprom_write()
550 eeprom.usec_delay_writecycles, eeprom.usec_delay_step)); in eeprom_write()
552 if (eeprom.usec_delay_step < 4) in eeprom_write()
554 eeprom.usec_delay_step++; in eeprom_write()
555 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
560 if (eeprom.adapt_state > 0) in eeprom_write()
563 eeprom.usec_delay_step *= 2; in eeprom_write()
564 if (eeprom.usec_delay_step > 2) in eeprom_write()
566 eeprom.usec_delay_step--; in eeprom_write()
568 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
570 else if (eeprom.adapt_state < 0) in eeprom_write()
573 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
574 if (eeprom.usec_delay_step > 1) in eeprom_write()
576 eeprom.usec_delay_step /= 2; in eeprom_write()
577 eeprom.usec_delay_step--; in eeprom_write()
582 eeprom.adapt_state = 1; in eeprom_write()
588 eeprom.usec_delay_writecycles, eeprom.usec_delay_step)); in eeprom_write()
590 if (eeprom.adapt_state < 0) in eeprom_write()
593 if (eeprom.usec_delay_step > 1) in eeprom_write()
595 eeprom.usec_delay_step *= 2; in eeprom_write()
596 eeprom.usec_delay_step--; in eeprom_write()
598 if (eeprom.usec_delay_writecycles > eeprom.usec_delay_step) in eeprom_write()
600 eeprom.usec_delay_writecycles -= eeprom.usec_delay_step; in eeprom_write()
604 else if (eeprom.adapt_state > 0) in eeprom_write()
607 if (eeprom.usec_delay_writecycles > eeprom.usec_delay_step) in eeprom_write()
609 eeprom.usec_delay_writecycles -= eeprom.usec_delay_step; in eeprom_write()
611 if (eeprom.usec_delay_step > 1) in eeprom_write()
613 eeprom.usec_delay_step /= 2; in eeprom_write()
614 eeprom.usec_delay_step--; in eeprom_write()
617 eeprom.adapt_state = -1; in eeprom_write()
620 if (eeprom.adapt_state > -100) in eeprom_write()
622 eeprom.adapt_state--; in eeprom_write()
628 eeprom.usec_delay_step++; in eeprom_write()
645 } while( written < count && ( p % eeprom.sequential_write_pagesize )); in eeprom_write()
649 i2c_delay(eeprom.usec_delay_writecycles); in eeprom_write()
653 mutex_unlock(&eeprom.lock); in eeprom_write()
654 if (written == 0 && p >= eeprom.size){ in eeprom_write()
684 if(eeprom.size == EEPROM_16KB) in eeprom_address()
686 i2c_outbyte( eeprom.select_cmd ); in eeprom_address()
692 i2c_outbyte( eeprom.select_cmd | (page << 1) ); in eeprom_address()
718 eeprom.retry_cnt_addr = i; in eeprom_address()
719 D(printk("%i\n", eeprom.retry_cnt_addr)); in eeprom_address()
720 if(eeprom.retry_cnt_addr == EEPROM_RETRIES) in eeprom_address()
736 if(eeprom.size == EEPROM_16KB) in read_from_eeprom()
738 i2c_outbyte( eeprom.select_cmd | 1 ); in read_from_eeprom()
787 if (eeprom.size == EEPROM_8KB) in eeprom_disable_write_protect()