Lines Matching refs:eeprom

155 static struct eeprom_type eeprom;  variable
171 init_waitqueue_head(&eeprom.wait_q); in eeprom_init()
172 eeprom.busy = 0; in eeprom_init()
197 eeprom.size = 0; in eeprom_init()
198 eeprom.usec_delay_writecycles = INITIAL_WRITEDELAY_US; in eeprom_init()
199 eeprom.usec_delay_step = 128; in eeprom_init()
200 eeprom.adapt_state = 0; in eeprom_init()
227 eeprom.size = EEPROM_2KB; in eeprom_init()
228 eeprom.select_cmd = 0xA0; in eeprom_init()
229 eeprom.sequential_write_pagesize = 16; in eeprom_init()
240 eeprom.size = EEPROM_16KB; in eeprom_init()
241 eeprom.select_cmd = 0xA0; in eeprom_init()
242 eeprom.sequential_write_pagesize = 64; in eeprom_init()
257 eeprom.size = EEPROM_16KB; in eeprom_init()
295 eeprom.size = EEPROM_2KB; in eeprom_init()
296 eeprom.select_cmd = 0xA0; in eeprom_init()
297 eeprom.sequential_write_pagesize = 16; in eeprom_init()
307 eeprom.size = EEPROM_2KB; in eeprom_init()
334 eeprom.size = EEPROM_2KB; in eeprom_init()
353 eeprom.size = EEPROM_16KB; in eeprom_init()
363 eeprom.size = EEPROM_2KB; in eeprom_init()
374 eeprom.size = EEPROM_2KB; in eeprom_init()
382 eeprom.size = EEPROM_2KB; in eeprom_init()
388 eeprom.size = EEPROM_8KB; in eeprom_init()
394 eeprom.size = EEPROM_16KB; in eeprom_init()
396 eeprom.size = EEPROM_8KB; in eeprom_init()
398 eeprom.size = EEPROM_2KB; in eeprom_init()
401 switch(eeprom.size) in eeprom_init()
405 eeprom.sequential_write_pagesize = 16; in eeprom_init()
406 eeprom.select_cmd = 0xA0; in eeprom_init()
410 eeprom.sequential_write_pagesize = 16; in eeprom_init()
411 eeprom.select_cmd = 0x80; in eeprom_init()
415 eeprom.sequential_write_pagesize = 64; in eeprom_init()
416 eeprom.select_cmd = 0xA0; in eeprom_init()
419 eeprom.size = 0; in eeprom_init()
441 if( eeprom.size > 0 ) in eeprom_open()
470 file->f_pos = eeprom.size - offset; in eeprom_lseek()
483 if (file->f_pos >= eeprom.size) in eeprom_lseek()
485 file->f_pos = eeprom.size - 1; in eeprom_lseek()
513 if(p >= eeprom.size) /* Address i 0 - (size-1) */ in eeprom_read()
518 while(eeprom.busy) in eeprom_read()
520 interruptible_sleep_on(&eeprom.wait_q); in eeprom_read()
527 eeprom.busy++; in eeprom_read()
538 eeprom.busy--; in eeprom_read()
539 wake_up_interruptible(&eeprom.wait_q); in eeprom_read()
543 if(count > eeprom.size - p) in eeprom_read()
546 count = eeprom.size - p; in eeprom_read()
553 if(eeprom.size < EEPROM_16KB) in eeprom_read()
555 i2c_outbyte( eeprom.select_cmd | 1 | (page << 1) ); in eeprom_read()
566 eeprom.busy--; in eeprom_read()
567 wake_up_interruptible(&eeprom.wait_q); in eeprom_read()
596 while(eeprom.busy) in eeprom_write()
598 interruptible_sleep_on(&eeprom.wait_q); in eeprom_write()
603 eeprom.busy++; in eeprom_write()
611 while( (written < count) && (p < eeprom.size)) in eeprom_write()
621 eeprom.busy--; in eeprom_write()
622 wake_up_interruptible(&eeprom.wait_q); in eeprom_write()
627 if (eeprom.retry_cnt_addr > 0) in eeprom_write()
631 eeprom.usec_delay_writecycles, eeprom.usec_delay_step)); in eeprom_write()
633 if (eeprom.usec_delay_step < 4) in eeprom_write()
635 eeprom.usec_delay_step++; in eeprom_write()
636 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
641 if (eeprom.adapt_state > 0) in eeprom_write()
644 eeprom.usec_delay_step *= 2; in eeprom_write()
645 if (eeprom.usec_delay_step > 2) in eeprom_write()
647 eeprom.usec_delay_step--; in eeprom_write()
649 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
651 else if (eeprom.adapt_state < 0) in eeprom_write()
654 eeprom.usec_delay_writecycles += eeprom.usec_delay_step; in eeprom_write()
655 if (eeprom.usec_delay_step > 1) in eeprom_write()
657 eeprom.usec_delay_step /= 2; in eeprom_write()
658 eeprom.usec_delay_step--; in eeprom_write()
663 eeprom.adapt_state = 1; in eeprom_write()
669 eeprom.usec_delay_writecycles, eeprom.usec_delay_step)); in eeprom_write()
671 if (eeprom.adapt_state < 0) in eeprom_write()
674 if (eeprom.usec_delay_step > 1) in eeprom_write()
676 eeprom.usec_delay_step *= 2; in eeprom_write()
677 eeprom.usec_delay_step--; in eeprom_write()
679 if (eeprom.usec_delay_writecycles > eeprom.usec_delay_step) in eeprom_write()
681 eeprom.usec_delay_writecycles -= eeprom.usec_delay_step; in eeprom_write()
685 else if (eeprom.adapt_state > 0) in eeprom_write()
688 if (eeprom.usec_delay_writecycles > eeprom.usec_delay_step) in eeprom_write()
690 eeprom.usec_delay_writecycles -= eeprom.usec_delay_step; in eeprom_write()
692 if (eeprom.usec_delay_step > 1) in eeprom_write()
694 eeprom.usec_delay_step /= 2; in eeprom_write()
695 eeprom.usec_delay_step--; in eeprom_write()
698 eeprom.adapt_state = -1; in eeprom_write()
701 if (eeprom.adapt_state > -100) in eeprom_write()
703 eeprom.adapt_state--; in eeprom_write()
709 eeprom.usec_delay_step++; in eeprom_write()
726 } while( written < count && ( p % eeprom.sequential_write_pagesize )); in eeprom_write()
730 i2c_delay(eeprom.usec_delay_writecycles); in eeprom_write()
734 eeprom.busy--; in eeprom_write()
735 wake_up_interruptible(&eeprom.wait_q); in eeprom_write()
736 if (written == 0 && p >= eeprom.size){ in eeprom_write()
766 if(eeprom.size == EEPROM_16KB) in eeprom_address()
768 i2c_outbyte( eeprom.select_cmd ); in eeprom_address()
774 i2c_outbyte( eeprom.select_cmd | (page << 1) ); in eeprom_address()
800 eeprom.retry_cnt_addr = i; in eeprom_address()
801 D(printk("%i\n", eeprom.retry_cnt_addr)); in eeprom_address()
802 if(eeprom.retry_cnt_addr == EEPROM_RETRIES) in eeprom_address()
818 if(eeprom.size == EEPROM_16KB) in read_from_eeprom()
820 i2c_outbyte( eeprom.select_cmd | 1 ); in read_from_eeprom()
869 if (eeprom.size == EEPROM_8KB) in eeprom_disable_write_protect()