diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-10-21 16:43:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 15:23:11 -0500 |
commit | abf1794e698d9bbdade846ef6ffd23b247cfb59f (patch) | |
tree | 0d6a09fb25c9d286b7126a463bde0a2dacd4df17 /drivers/staging/rt2860 | |
parent | fbedb45f6a547901781d23d0e70ef77e0724cb1c (diff) |
Staging: rt28x0: remove unused code from common/ee_efuse-c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860')
-rw-r--r-- | drivers/staging/rt2860/common/ee_efuse.c | 340 | ||||
-rw-r--r-- | drivers/staging/rt2860/rtmp.h | 12 |
2 files changed, 0 insertions, 352 deletions
diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index f29445096cf..5807cc4ff96 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c | |||
@@ -67,31 +67,6 @@ typedef union _EFUSE_CTRL_STRUC { | |||
67 | UINT32 word; | 67 | UINT32 word; |
68 | } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; | 68 | } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; |
69 | 69 | ||
70 | static UCHAR eFuseReadRegisters( | ||
71 | IN PRTMP_ADAPTER pAd, | ||
72 | IN USHORT Offset, | ||
73 | IN USHORT Length, | ||
74 | OUT USHORT* pData); | ||
75 | |||
76 | static VOID eFuseReadPhysical( | ||
77 | IN PRTMP_ADAPTER pAd, | ||
78 | IN PUSHORT lpInBuffer, | ||
79 | IN ULONG nInBufferSize, | ||
80 | OUT PUSHORT lpOutBuffer, | ||
81 | IN ULONG nOutBufferSize); | ||
82 | |||
83 | static VOID eFusePhysicalWriteRegisters( | ||
84 | IN PRTMP_ADAPTER pAd, | ||
85 | IN USHORT Offset, | ||
86 | IN USHORT Length, | ||
87 | OUT USHORT* pData); | ||
88 | |||
89 | static NTSTATUS eFuseWriteRegisters( | ||
90 | IN PRTMP_ADAPTER pAd, | ||
91 | IN USHORT Offset, | ||
92 | IN USHORT Length, | ||
93 | IN USHORT* pData); | ||
94 | |||
95 | static VOID eFuseWritePhysical( | 70 | static VOID eFuseWritePhysical( |
96 | IN PRTMP_ADAPTER pAd, | 71 | IN PRTMP_ADAPTER pAd, |
97 | PUSHORT lpInBuffer, | 72 | PUSHORT lpInBuffer, |
@@ -306,37 +281,6 @@ static VOID eFuseReadPhysical( | |||
306 | 281 | ||
307 | ======================================================================== | 282 | ======================================================================== |
308 | */ | 283 | */ |
309 | NTSTATUS eFuseRead( | ||
310 | IN PRTMP_ADAPTER pAd, | ||
311 | IN USHORT Offset, | ||
312 | OUT PUCHAR pData, | ||
313 | IN USHORT Length) | ||
314 | { | ||
315 | USHORT* pOutBuf = (USHORT*)pData; | ||
316 | NTSTATUS Status = STATUS_SUCCESS; | ||
317 | UCHAR EFSROM_AOUT; | ||
318 | int i; | ||
319 | |||
320 | for(i=0; i<Length; i+=2) | ||
321 | { | ||
322 | EFSROM_AOUT = eFuseReadRegisters(pAd, Offset+i, 2, &pOutBuf[i/2]); | ||
323 | } | ||
324 | return Status; | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | ======================================================================== | ||
329 | |||
330 | Routine Description: | ||
331 | |||
332 | Arguments: | ||
333 | |||
334 | Return Value: | ||
335 | |||
336 | Note: | ||
337 | |||
338 | ======================================================================== | ||
339 | */ | ||
340 | static VOID eFusePhysicalWriteRegisters( | 284 | static VOID eFusePhysicalWriteRegisters( |
341 | IN PRTMP_ADAPTER pAd, | 285 | IN PRTMP_ADAPTER pAd, |
342 | IN USHORT Offset, | 286 | IN USHORT Offset, |
@@ -450,247 +394,6 @@ static VOID eFusePhysicalWriteRegisters( | |||
450 | 394 | ||
451 | ======================================================================== | 395 | ======================================================================== |
452 | */ | 396 | */ |
453 | static NTSTATUS eFuseWriteRegisters( | ||
454 | IN PRTMP_ADAPTER pAd, | ||
455 | IN USHORT Offset, | ||
456 | IN USHORT Length, | ||
457 | IN USHORT* pData) | ||
458 | { | ||
459 | USHORT i,Loop=0; | ||
460 | USHORT eFuseData; | ||
461 | USHORT LogicalAddress, BlkNum = 0xffff; | ||
462 | UCHAR EFSROM_AOUT; | ||
463 | |||
464 | USHORT addr,tmpaddr, InBuf[3], tmpOffset; | ||
465 | USHORT buffer[8]; | ||
466 | BOOLEAN bWriteSuccess = TRUE; | ||
467 | |||
468 | DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters Offset=%x, pData=%x\n", Offset, *pData)); | ||
469 | |||
470 | //Step 0. find the entry in the mapping table | ||
471 | //The address of EEPROM is 2-bytes alignment. | ||
472 | //The last bit is used for alignment, so it must be 0. | ||
473 | tmpOffset = Offset & 0xfffe; | ||
474 | EFSROM_AOUT = eFuseReadRegisters(pAd, tmpOffset, 2, &eFuseData); | ||
475 | |||
476 | if( EFSROM_AOUT == 0x3f) | ||
477 | { //find available logical address pointer | ||
478 | //the logical address does not exist, find an empty one | ||
479 | //from the first address of block 45=16*45=0x2d0 to the last address of block 47 | ||
480 | //==>48*16-3(reserved)=2FC | ||
481 | for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) | ||
482 | { | ||
483 | //Retrive the logical block nubmer form each logical address pointer | ||
484 | //It will access two logical address pointer each time. | ||
485 | eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); | ||
486 | if( (LogicalAddress & 0xff) == 0) | ||
487 | {//Not used logical address pointer | ||
488 | BlkNum = i-EFUSE_USAGE_MAP_START; | ||
489 | break; | ||
490 | } | ||
491 | else if(( (LogicalAddress >> 8) & 0xff) == 0) | ||
492 | {//Not used logical address pointer | ||
493 | if (i != EFUSE_USAGE_MAP_END) | ||
494 | { | ||
495 | BlkNum = i-EFUSE_USAGE_MAP_START+1; | ||
496 | } | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | } | ||
501 | else | ||
502 | { | ||
503 | BlkNum = EFSROM_AOUT; | ||
504 | } | ||
505 | |||
506 | DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); | ||
507 | |||
508 | if(BlkNum == 0xffff) | ||
509 | { | ||
510 | DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); | ||
511 | return FALSE; | ||
512 | } | ||
513 | |||
514 | //Step 1. Save data of this block which is pointed by the avaible logical address pointer | ||
515 | // read and save the original block data | ||
516 | for(i =0; i<8; i++) | ||
517 | { | ||
518 | addr = BlkNum * 0x10 ; | ||
519 | |||
520 | InBuf[0] = addr+2*i; | ||
521 | InBuf[1] = 2; | ||
522 | InBuf[2] = 0x0; | ||
523 | |||
524 | eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); | ||
525 | |||
526 | buffer[i] = InBuf[2]; | ||
527 | } | ||
528 | |||
529 | //Step 2. Update the data in buffer, and write the data to Efuse | ||
530 | buffer[ (Offset >> 1) % 8] = pData[0]; | ||
531 | |||
532 | do | ||
533 | { Loop++; | ||
534 | //Step 3. Write the data to Efuse | ||
535 | if(!bWriteSuccess) | ||
536 | { | ||
537 | for(i =0; i<8; i++) | ||
538 | { | ||
539 | addr = BlkNum * 0x10 ; | ||
540 | |||
541 | InBuf[0] = addr+2*i; | ||
542 | InBuf[1] = 2; | ||
543 | InBuf[2] = buffer[i]; | ||
544 | |||
545 | eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); | ||
546 | } | ||
547 | } | ||
548 | else | ||
549 | { | ||
550 | addr = BlkNum * 0x10 ; | ||
551 | |||
552 | InBuf[0] = addr+(Offset % 16); | ||
553 | InBuf[1] = 2; | ||
554 | InBuf[2] = pData[0]; | ||
555 | |||
556 | eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); | ||
557 | } | ||
558 | |||
559 | //Step 4. Write mapping table | ||
560 | addr = EFUSE_USAGE_MAP_START+BlkNum; | ||
561 | |||
562 | tmpaddr = addr; | ||
563 | |||
564 | if(addr % 2 != 0) | ||
565 | addr = addr -1; | ||
566 | InBuf[0] = addr; | ||
567 | InBuf[1] = 2; | ||
568 | |||
569 | //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry | ||
570 | tmpOffset = Offset; | ||
571 | tmpOffset >>= 4; | ||
572 | tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; | ||
573 | tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; | ||
574 | |||
575 | // write the logical address | ||
576 | if(tmpaddr%2 != 0) | ||
577 | InBuf[2] = tmpOffset<<8; | ||
578 | else | ||
579 | InBuf[2] = tmpOffset; | ||
580 | |||
581 | eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); | ||
582 | |||
583 | //Step 5. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted | ||
584 | bWriteSuccess = TRUE; | ||
585 | for(i =0; i<8; i++) | ||
586 | { | ||
587 | addr = BlkNum * 0x10 ; | ||
588 | |||
589 | InBuf[0] = addr+2*i; | ||
590 | InBuf[1] = 2; | ||
591 | InBuf[2] = 0x0; | ||
592 | |||
593 | eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); | ||
594 | |||
595 | if(buffer[i] != InBuf[2]) | ||
596 | { | ||
597 | bWriteSuccess = FALSE; | ||
598 | break; | ||
599 | } | ||
600 | } | ||
601 | |||
602 | //Step 6. invlidate mapping entry and find a free mapping entry if not succeed | ||
603 | if (!bWriteSuccess) | ||
604 | { | ||
605 | DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess BlkNum = %d\n", BlkNum)); | ||
606 | |||
607 | // the offset of current mapping entry | ||
608 | addr = EFUSE_USAGE_MAP_START+BlkNum; | ||
609 | |||
610 | //find a new mapping entry | ||
611 | BlkNum = 0xffff; | ||
612 | for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) | ||
613 | { | ||
614 | eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); | ||
615 | if( (LogicalAddress & 0xff) == 0) | ||
616 | { | ||
617 | BlkNum = i-EFUSE_USAGE_MAP_START; | ||
618 | break; | ||
619 | } | ||
620 | else if(( (LogicalAddress >> 8) & 0xff) == 0) | ||
621 | { | ||
622 | if (i != EFUSE_USAGE_MAP_END) | ||
623 | { | ||
624 | BlkNum = i+1-EFUSE_USAGE_MAP_START; | ||
625 | } | ||
626 | break; | ||
627 | } | ||
628 | } | ||
629 | DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess new BlkNum = %d\n", BlkNum)); | ||
630 | if(BlkNum == 0xffff) | ||
631 | { | ||
632 | DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); | ||
633 | return FALSE; | ||
634 | } | ||
635 | |||
636 | //invalidate the original mapping entry if new entry is not found | ||
637 | tmpaddr = addr; | ||
638 | |||
639 | if(addr % 2 != 0) | ||
640 | addr = addr -1; | ||
641 | InBuf[0] = addr; | ||
642 | InBuf[1] = 2; | ||
643 | |||
644 | eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); | ||
645 | |||
646 | // write the logical address | ||
647 | if(tmpaddr%2 != 0) | ||
648 | { | ||
649 | // Invalidate the high byte | ||
650 | for (i=8; i<15; i++) | ||
651 | { | ||
652 | if( ( (InBuf[2] >> i) & 0x01) == 0) | ||
653 | { | ||
654 | InBuf[2] |= (0x1 <<i); | ||
655 | break; | ||
656 | } | ||
657 | } | ||
658 | } | ||
659 | else | ||
660 | { | ||
661 | // invalidate the low byte | ||
662 | for (i=0; i<8; i++) | ||
663 | { | ||
664 | if( ( (InBuf[2] >> i) & 0x01) == 0) | ||
665 | { | ||
666 | InBuf[2] |= (0x1 <<i); | ||
667 | break; | ||
668 | } | ||
669 | } | ||
670 | } | ||
671 | eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 0); | ||
672 | } | ||
673 | } | ||
674 | while (!bWriteSuccess&&Loop<2); | ||
675 | if(!bWriteSuccess) | ||
676 | DBGPRINT(RT_DEBUG_ERROR,("Efsue Write Failed!!\n")); | ||
677 | return TRUE; | ||
678 | } | ||
679 | |||
680 | |||
681 | /* | ||
682 | ======================================================================== | ||
683 | |||
684 | Routine Description: | ||
685 | |||
686 | Arguments: | ||
687 | |||
688 | Return Value: | ||
689 | |||
690 | Note: | ||
691 | |||
692 | ======================================================================== | ||
693 | */ | ||
694 | static VOID eFuseWritePhysical( | 397 | static VOID eFuseWritePhysical( |
695 | IN PRTMP_ADAPTER pAd, | 398 | IN PRTMP_ADAPTER pAd, |
696 | PUSHORT lpInBuffer, | 399 | PUSHORT lpInBuffer, |
@@ -723,49 +426,6 @@ static VOID eFuseWritePhysical( | |||
723 | } | 426 | } |
724 | } | 427 | } |
725 | 428 | ||
726 | |||
727 | /* | ||
728 | ======================================================================== | ||
729 | |||
730 | Routine Description: | ||
731 | |||
732 | Arguments: | ||
733 | |||
734 | Return Value: | ||
735 | |||
736 | Note: | ||
737 | |||
738 | ======================================================================== | ||
739 | */ | ||
740 | NTSTATUS eFuseWrite( | ||
741 | IN PRTMP_ADAPTER pAd, | ||
742 | IN USHORT Offset, | ||
743 | IN PUCHAR pData, | ||
744 | IN USHORT length) | ||
745 | { | ||
746 | int i; | ||
747 | USHORT* pValueX = (PUSHORT) pData; //value ... | ||
748 | |||
749 | // The input value=3070 will be stored as following | ||
750 | // Little-endian S | S Big-endian | ||
751 | // addr 1 0 | 0 1 | ||
752 | // Ori-V 30 70 | 30 70 | ||
753 | // After swapping | ||
754 | // 30 70 | 70 30 | ||
755 | // Casting | ||
756 | // 3070 | 7030 (x) | ||
757 | // The swapping should be removed for big-endian | ||
758 | for(i=0; i<length; i+=2) | ||
759 | { | ||
760 | eFuseWriteRegisters(pAd, Offset+i, 2, &pValueX[i/2]); | ||
761 | } | ||
762 | |||
763 | return TRUE; | ||
764 | } | ||
765 | |||
766 | |||
767 | |||
768 | |||
769 | /* | 429 | /* |
770 | ======================================================================== | 430 | ======================================================================== |
771 | 431 | ||
diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 3e284f241fc..c9e3045b3a6 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h | |||
@@ -4052,18 +4052,6 @@ VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, | |||
4052 | 4052 | ||
4053 | INT eFuse_init( | 4053 | INT eFuse_init( |
4054 | IN PRTMP_ADAPTER pAd); | 4054 | IN PRTMP_ADAPTER pAd); |
4055 | |||
4056 | NTSTATUS eFuseRead( | ||
4057 | IN PRTMP_ADAPTER pAd, | ||
4058 | IN USHORT Offset, | ||
4059 | OUT PUCHAR pData, | ||
4060 | IN USHORT Length); | ||
4061 | |||
4062 | NTSTATUS eFuseWrite( | ||
4063 | IN PRTMP_ADAPTER pAd, | ||
4064 | IN USHORT Offset, | ||
4065 | IN PUCHAR pData, | ||
4066 | IN USHORT length); | ||
4067 | //2008/09/11:KH add to support efuse--> | 4055 | //2008/09/11:KH add to support efuse--> |
4068 | #endif // RTMP_EFUSE_SUPPORT // | 4056 | #endif // RTMP_EFUSE_SUPPORT // |
4069 | 4057 | ||