diff options
Diffstat (limited to 'firmware/target/arm/ata-nand-telechips.c')
-rw-r--r-- | firmware/target/arm/ata-nand-telechips.c | 93 |
1 files changed, 14 insertions, 79 deletions
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c index 1c135650f1..4276c10d64 100644 --- a/firmware/target/arm/ata-nand-telechips.c +++ b/firmware/target/arm/ata-nand-telechips.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "ata.h" | 21 | #include "nand.h" |
22 | #include "ata-nand-target.h" | 22 | #include "ata-nand-target.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include <string.h> | 24 | #include <string.h> |
@@ -31,6 +31,7 @@ | |||
31 | #include "lcd.h" | 31 | #include "lcd.h" |
32 | #include "font.h" | 32 | #include "font.h" |
33 | #include "button.h" | 33 | #include "button.h" |
34 | #include "storage.h" | ||
34 | #include <sprintf.h> | 35 | #include <sprintf.h> |
35 | 36 | ||
36 | #define SECTOR_SIZE 512 | 37 | #define SECTOR_SIZE 512 |
@@ -43,9 +44,6 @@ int ata_spinup_time = 0; | |||
43 | 44 | ||
44 | long last_disk_activity = -1; | 45 | long last_disk_activity = -1; |
45 | 46 | ||
46 | /* as we aren't actually ata manually fill some fields */ | ||
47 | static unsigned short ata_identify[SECTOR_SIZE/2]; | ||
48 | |||
49 | /** static, private data **/ | 47 | /** static, private data **/ |
50 | static bool initialized = false; | 48 | static bool initialized = false; |
51 | 49 | ||
@@ -662,7 +660,7 @@ static void read_write_cache_segment(int bank, int phys_segment) | |||
662 | } | 660 | } |
663 | 661 | ||
664 | 662 | ||
665 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, | 663 | int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, |
666 | void* inbuf) | 664 | void* inbuf) |
667 | { | 665 | { |
668 | #ifdef HAVE_MULTIVOLUME | 666 | #ifdef HAVE_MULTIVOLUME |
@@ -702,7 +700,7 @@ int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, | |||
702 | return 0; | 700 | return 0; |
703 | } | 701 | } |
704 | 702 | ||
705 | int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, | 703 | int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, |
706 | const void* outbuf) | 704 | const void* outbuf) |
707 | { | 705 | { |
708 | #ifdef HAVE_MULTIVOLUME | 706 | #ifdef HAVE_MULTIVOLUME |
@@ -716,83 +714,21 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, | |||
716 | return -1; | 714 | return -1; |
717 | } | 715 | } |
718 | 716 | ||
719 | void ata_spindown(int seconds) | 717 | void nand_get_info(struct storage_info *info) |
720 | { | ||
721 | /* null */ | ||
722 | (void)seconds; | ||
723 | } | ||
724 | |||
725 | bool ata_disk_is_active(void) | ||
726 | { | ||
727 | /* null */ | ||
728 | return 0; | ||
729 | } | ||
730 | |||
731 | void ata_sleep(void) | ||
732 | { | 718 | { |
733 | /* null */ | ||
734 | } | ||
735 | |||
736 | void ata_spin(void) | ||
737 | { | ||
738 | /* null */ | ||
739 | } | ||
740 | |||
741 | /* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */ | ||
742 | int ata_hard_reset(void) | ||
743 | { | ||
744 | /* null */ | ||
745 | return 0; | ||
746 | } | ||
747 | |||
748 | int ata_soft_reset(void) | ||
749 | { | ||
750 | /* null */ | ||
751 | return 0; | ||
752 | } | ||
753 | |||
754 | void ata_enable(bool on) | ||
755 | { | ||
756 | /* null - flash controller is enabled/disabled as needed. */ | ||
757 | (void)on; | ||
758 | } | ||
759 | |||
760 | static void fill_identify(void) | ||
761 | { | ||
762 | char buf[80]; | ||
763 | unsigned short *wbuf = (unsigned short *) buf; | ||
764 | unsigned long blocks; | ||
765 | int i; | ||
766 | |||
767 | memset(ata_identify, 0, sizeof(ata_identify)); | ||
768 | |||
769 | /* firmware version */ | 719 | /* firmware version */ |
770 | memset(buf, ' ', 8); | 720 | info->revision="0.00"; |
771 | memcpy(buf, "0.00", 4); | ||
772 | 721 | ||
773 | for (i = 0; i < 4; i++) | 722 | info->vendor="Rockbox"; |
774 | ata_identify[23 + i] = betoh16(wbuf[i]); | 723 | info->product="Internal Storage"; |
775 | |||
776 | /* model field, need better name? */ | ||
777 | memset(buf, ' ', 80); | ||
778 | memcpy(buf, "TNFL", 4); | ||
779 | |||
780 | for (i = 0; i < 40; i++) | ||
781 | ata_identify[27 + i] = betoh16(wbuf[i]); | ||
782 | 724 | ||
783 | /* blocks count */ | 725 | /* blocks count */ |
784 | blocks = (pages_per_block * blocks_per_bank / SECTOR_SIZE) | 726 | info->num_sectors = (pages_per_block * blocks_per_bank / SECTOR_SIZE) |
785 | * page_size * total_banks; | 727 | * page_size * total_banks; |
786 | ata_identify[60] = blocks & 0xffff; | 728 | info->sector_size=SECTOR_SIZE; |
787 | ata_identify[61] = blocks >> 16; | ||
788 | |||
789 | /* TODO: discover where is s/n in TNFL */ | ||
790 | for (i = 10; i < 20; i++) { | ||
791 | ata_identify[i] = 0; | ||
792 | } | ||
793 | } | 729 | } |
794 | 730 | ||
795 | int ata_init(void) | 731 | int nand_init(void) |
796 | { | 732 | { |
797 | int i, bank, phys_segment; | 733 | int i, bank, phys_segment; |
798 | unsigned char spare_buf[16]; | 734 | unsigned char spare_buf[16]; |
@@ -909,13 +845,12 @@ int ata_init(void) | |||
909 | } | 845 | } |
910 | #endif | 846 | #endif |
911 | 847 | ||
912 | fill_identify(); | ||
913 | initialized = true; | 848 | initialized = true; |
914 | 849 | ||
915 | return 0; | 850 | return 0; |
916 | } | 851 | } |
917 | 852 | ||
918 | unsigned short* ata_get_identify(void) | 853 | long nand_last_disk_activity(void) |
919 | { | 854 | { |
920 | return ata_identify; | 855 | return last_disk_activity; |
921 | } | 856 | } |