summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-01 17:01:40 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-01 17:01:40 +0000
commit212f18f9ea28dce5a8142c6546453ada1c23b693 (patch)
treeffae1caf6bdd9db456f7b73e00e6b964aaa48d6b /firmware
parentc4b326c215120acd0e28b311301ef748094b73e8 (diff)
downloadrockbox-212f18f9ea28dce5a8142c6546453ada1c23b693.tar.gz
rockbox-212f18f9ea28dce5a8142c6546453ada1c23b693.zip
Fix: card initialization on card_select()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5142 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata_mmc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index c114743d27..3525203840 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -137,6 +137,11 @@ static int initialize_card(int card_no);
137 137
138static int select_card(int card_no) 138static int select_card(int card_no)
139{ 139{
140 if (card_no == 0) /* internal */
141 or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */
142 else /* external */
143 and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/
144
140 if (!card_info[card_no].initialized) 145 if (!card_info[card_no].initialized)
141 { 146 {
142 setup_sci1(7); /* Initial rate: 375 kbps (need <= 400 per mmc specs) */ 147 setup_sci1(7); /* Initial rate: 375 kbps (need <= 400 per mmc specs) */
@@ -144,16 +149,10 @@ static int select_card(int card_no)
144 while (!(SSR1 & SCI_TEND)); 149 while (!(SSR1 & SCI_TEND));
145 } 150 }
146 151
147 if (card_no == 0) 152 if (card_no == 0) /* internal */
148 { /* internal */
149 or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */
150 and_b(~0x04, &PADRH); /* assert CS */ 153 and_b(~0x04, &PADRH); /* assert CS */
151 } 154 else /* external */
152 else
153 { /* external */
154 and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/
155 and_b(~0x02, &PADRH); /* assert CS */ 155 and_b(~0x02, &PADRH); /* assert CS */
156 }
157 156
158 if (card_info[card_no].initialized) 157 if (card_info[card_no].initialized)
159 { 158 {
@@ -504,7 +503,7 @@ int ata_write_sectors(unsigned long start,
504 503
505 deselect_card(); 504 deselect_card();
506 mutex_unlock(&ata_mtx); 505 mutex_unlock(&ata_mtx);
507 506
508 return ret; 507 return ret;
509} 508}
510 509