summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2009-12-03 17:22:03 +0000
committerJack Halpin <jack.halpin@gmail.com>2009-12-03 17:22:03 +0000
commit40629be046f8772d404ec5577be2452f5c516ef6 (patch)
treeac4b77140dbd32fced1edc8dc29d2f9c98d57a2f
parentd8f420a48d9d0a9057dfb5760b877568f2e52538 (diff)
downloadrockbox-40629be046f8772d404ec5577be2452f5c516ef6.zip
rockbox-40629be046f8772d404ec5577be2452f5c516ef6.tar.gz
rockbox-40629be046f8772d404ec5577be2452f5c516ef6.tar.bz2
rockbox-40629be046f8772d404ec5577be2452f5c516ef6.tar.xz
Sansa AMS: Wait until sd_init_card() to turn on the clocks for the pl180 controller.
Currently the bypass bit is not cleared so it's possible to enter the identification phase at bypass speed instead of ident speed. The simplest solution to ensure the bypass bit is not set is to set the register with an = operation instead of |=. This makes setting the MCI_CLOCK register at the end of the controller init unnecessary. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23830 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index f9a8759..961a124 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -257,13 +257,12 @@ static int sd_init_card(const int drive)
int i;
- /* 100 - 400kHz clock required for Identification Mode */
- MCI_CLOCK(drive) = (MCI_CLOCK(drive) & 0xf00) | AS3525_SD_IDENT_DIV;
-
+ /* MCLCK on and set to 400kHz ident frequency */
+ MCI_CLOCK(drive) = MCI_CLOCK_ENABLE | AS3525_SD_IDENT_DIV;
+ /* 100 - 400kHz clock required for Identification Mode */
/* Start of Card Identification Mode ************************************/
-
/* CMD0 Go Idle */
if(!send_cmd(drive, SD_GO_IDLE_STATE, 0, MCI_NO_FLAGS, NULL))
return -1;
@@ -306,10 +305,8 @@ static int sd_init_card(const int drive)
&card_info[drive].rca))
return -4;
-
/* End of Card Identification Mode ************************************/
-
/* full speed for controller clock MCICLK = MCLK = PCLK = 62 MHz */
MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* FIXME: 50 MHz is spec limit */
mci_delay();
@@ -490,8 +487,7 @@ static void init_pl180_controller(const int drive)
MCI_SELECT(drive) = 0;
- MCI_CLOCK(drive) = MCI_CLOCK_ENABLE;
- mci_delay();
+ /* Pl180 clocks get turned on at start of card init */
}
int sd_init(void)