diff options
author | Björn Stenberg <bjorn@haxx.se> | 2004-01-14 13:15:19 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2004-01-14 13:15:19 +0000 |
commit | a53afc0330b4b5f0a4682d594853bae1cee35676 (patch) | |
tree | 760763fc4ceac07c1f8bb5adcae95cf87873061e /firmware/drivers | |
parent | d2b625f818e8e04ace3c7532fe9c38eb0c0b1662 (diff) | |
download | rockbox-a53afc0330b4b5f0a4682d594853bae1cee35676.tar.gz rockbox-a53afc0330b4b5f0a4682d594853bae1cee35676.zip |
Added acoustic management, power management and read look-ahead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4230 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 0ed0877034..725d33e4a0 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #define CMD_STANDBY 0xE2 | 69 | #define CMD_STANDBY 0xE2 |
70 | #define CMD_IDENTIFY 0xEC | 70 | #define CMD_IDENTIFY 0xEC |
71 | #define CMD_SLEEP 0xE6 | 71 | #define CMD_SLEEP 0xE6 |
72 | #define CMD_SET_FEATURES 0xEF | ||
72 | #define CMD_SECURITY_FREEZE_LOCK 0xF5 | 73 | #define CMD_SECURITY_FREEZE_LOCK 0xF5 |
73 | 74 | ||
74 | #define Q_SLEEP 0 | 75 | #define Q_SLEEP 0 |
@@ -773,6 +774,44 @@ static int set_multiple_mode(int sectors) | |||
773 | return 0; | 774 | return 0; |
774 | } | 775 | } |
775 | 776 | ||
777 | static int set_features(void) | ||
778 | { | ||
779 | struct { | ||
780 | unsigned char id_word; | ||
781 | unsigned char id_bit; | ||
782 | unsigned char subcommand; | ||
783 | unsigned char parameter; | ||
784 | } features[] = { | ||
785 | { 83, 3, 0x05, 1 }, /* power management: lowest power */ | ||
786 | { 83, 9, 0x42, 0x80 }, /* acoustic management: lowest noise */ | ||
787 | { 82, 6, 0xaa, 0 }, /* enable read look-ahead */ | ||
788 | { 0, 0, 0, 0 } /* <end of list> */ | ||
789 | }; | ||
790 | int i; | ||
791 | |||
792 | ATA_SELECT = ata_device; | ||
793 | |||
794 | if (!wait_for_rdy()) { | ||
795 | DEBUGF("set_features() - not RDY\n"); | ||
796 | return -1; | ||
797 | } | ||
798 | |||
799 | for (i=0; features[i].id_word; i++) { | ||
800 | if (identify_info[features[i].id_word] & (1 << features[i].id_bit)) { | ||
801 | ATA_FEATURE = features[i].subcommand; | ||
802 | ATA_NSECTOR = features[i].parameter; | ||
803 | ATA_COMMAND = CMD_SET_FEATURES; | ||
804 | |||
805 | if (!wait_for_rdy()) { | ||
806 | DEBUGF("set_features() - CMD failed\n"); | ||
807 | return -2 - i; | ||
808 | } | ||
809 | } | ||
810 | } | ||
811 | |||
812 | return 0; | ||
813 | } | ||
814 | |||
776 | unsigned short* ata_get_identify(void) | 815 | unsigned short* ata_get_identify(void) |
777 | { | 816 | { |
778 | return identify_info; | 817 | return identify_info; |
@@ -842,6 +881,10 @@ int ata_init(void) | |||
842 | multisectors = identify_info[47] & 0xff; | 881 | multisectors = identify_info[47] & 0xff; |
843 | DEBUGF("ata: %d sectors per ata request\n",multisectors); | 882 | DEBUGF("ata: %d sectors per ata request\n",multisectors); |
844 | 883 | ||
884 | rc = set_features(); | ||
885 | if (rc) | ||
886 | return -60 + rc; | ||
887 | |||
845 | queue_init(&ata_queue); | 888 | queue_init(&ata_queue); |
846 | 889 | ||
847 | last_disk_activity = current_tick; | 890 | last_disk_activity = current_tick; |
@@ -851,7 +894,7 @@ int ata_init(void) | |||
851 | } | 894 | } |
852 | rc = set_multiple_mode(multisectors); | 895 | rc = set_multiple_mode(multisectors); |
853 | if (rc) | 896 | if (rc) |
854 | return -60 + rc; | 897 | return -70 + rc; |
855 | 898 | ||
856 | return 0; | 899 | return 0; |
857 | } | 900 | } |