summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-01-18 12:32:03 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-01-18 12:32:03 +0000
commit3b36b98ff8dea187bd6c25174978da4f7b5e3231 (patch)
tree7cd2467638206b6e3aa167bd64cae85af5f1bcca /firmware/target/arm
parent536b5a0482454d3e3104f2a77a29d37319bc845c (diff)
downloadrockbox-3b36b98ff8dea187bd6c25174978da4f7b5e3231.tar.gz
rockbox-3b36b98ff8dea187bd6c25174978da4f7b5e3231.zip
Properly serialize ata_init with other threads. Fix a bug that always initialized the lock on every call to ata_init - that should be a one time init or else the lock could be corrupted on connect.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16104 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/sandisk/ata-c200_e200.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c
index 5a7577f08d..ef2bad387b 100644
--- a/firmware/target/arm/sandisk/ata-c200_e200.c
+++ b/firmware/target/arm/sandisk/ata-c200_e200.c
@@ -1149,17 +1149,17 @@ int ata_init(void)
1149{ 1149{
1150 int ret = 0; 1150 int ret = 0;
1151 1151
1152 if (!initialized)
1153 spinlock_init(&sd_spin IF_COP(, SPINLOCK_TASK_SWITCH));
1154
1155 spinlock_lock(&sd_spin);
1156
1152 ata_led(false); 1157 ata_led(false);
1153 1158
1154 /* NOTE: This init isn't dual core safe */
1155 if (!initialized) 1159 if (!initialized)
1156 { 1160 {
1157 initialized = true; 1161 initialized = true;
1158 1162
1159 spinlock_init(&sd_spin IF_COP(, SPINLOCK_TASK_SWITCH));
1160
1161 spinlock_lock(&sd_spin);
1162
1163 /* init controller */ 1163 /* init controller */
1164 outl(inl(0x70000088) & ~(0x4), 0x70000088); 1164 outl(inl(0x70000088) & ~(0x4), 0x70000088);
1165 outl(inl(0x7000008c) & ~(0x4), 0x7000008c); 1165 outl(inl(0x7000008c) & ~(0x4), 0x7000008c);
@@ -1213,9 +1213,10 @@ int ata_init(void)
1213 GPIOL_INT_EN |= 0x08; 1213 GPIOL_INT_EN |= 0x08;
1214#endif 1214#endif
1215#endif 1215#endif
1216 spinlock_unlock(&sd_spin);
1217 } 1216 }
1218 1217
1218 spinlock_unlock(&sd_spin);
1219
1219 return ret; 1220 return ret;
1220} 1221}
1221 1222