From 212f18f9ea28dce5a8142c6546453ada1c23b693 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 1 Oct 2004 17:01:40 +0000 Subject: Fix: card initialization on card_select() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5142 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata_mmc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'firmware/drivers/ata_mmc.c') 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); static int select_card(int card_no) { + if (card_no == 0) /* internal */ + or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ + else /* external */ + and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ + if (!card_info[card_no].initialized) { setup_sci1(7); /* Initial rate: 375 kbps (need <= 400 per mmc specs) */ @@ -144,16 +149,10 @@ static int select_card(int card_no) while (!(SSR1 & SCI_TEND)); } - if (card_no == 0) - { /* internal */ - or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ + if (card_no == 0) /* internal */ and_b(~0x04, &PADRH); /* assert CS */ - } - else - { /* external */ - and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ + else /* external */ and_b(~0x02, &PADRH); /* assert CS */ - } if (card_info[card_no].initialized) { @@ -504,7 +503,7 @@ int ata_write_sectors(unsigned long start, deselect_card(); mutex_unlock(&ata_mtx); - + return ret; } -- cgit v1.2.3