summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc/sdmmc_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sdmmc/sdmmc_mem.c')
-rw-r--r--sys/dev/sdmmc/sdmmc_mem.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c
index 682f8e9c5bb..f495bcfa28d 100644
--- a/sys/dev/sdmmc/sdmmc_mem.c
+++ b/sys/dev/sdmmc/sdmmc_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_mem.c,v 1.11 2009/02/20 19:16:35 miod Exp $ */
+/* $OpenBSD: sdmmc_mem.c,v 1.12 2009/04/07 16:35:52 blambert Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -51,6 +51,8 @@ sdmmc_mem_enable(struct sdmmc_softc *sc)
u_int32_t host_ocr;
u_int32_t card_ocr;
+ SDMMC_ASSERT_LOCKED(sc);
+
/* Set host mode to SD "combo" card or SD memory-only. */
SET(sc->sc_flags, SMF_SD_MODE|SMF_MEM_MODE);
@@ -117,6 +119,8 @@ sdmmc_mem_scan(struct sdmmc_softc *sc)
int error;
int i;
+ SDMMC_ASSERT_LOCKED(sc);
+
/*
* CMD2 is a broadcast command understood by SD cards and MMC
* cards. All cards begin to respond to the command, but back
@@ -324,11 +328,11 @@ sdmmc_mem_init(struct sdmmc_softc *sc, struct sdmmc_function *sf)
{
int error = 0;
- SDMMC_LOCK(sc);
+ SDMMC_ASSERT_LOCKED(sc);
+
if (sdmmc_select_card(sc, sf) != 0 ||
sdmmc_mem_set_blocklen(sc, sf) != 0)
error = 1;
- SDMMC_UNLOCK(sc);
return error;
}
@@ -343,7 +347,7 @@ sdmmc_mem_send_op_cond(struct sdmmc_softc *sc, u_int32_t ocr,
int error;
int i;
- SDMMC_LOCK(sc);
+ SDMMC_ASSERT_LOCKED(sc);
/*
* If we change the OCR value, retry the command until the OCR
@@ -373,7 +377,6 @@ sdmmc_mem_send_op_cond(struct sdmmc_softc *sc, u_int32_t ocr,
if (error == 0 && ocrp != NULL)
*ocrp = MMC_R3(cmd.c_resp);
- SDMMC_UNLOCK(sc);
return error;
}
@@ -386,6 +389,8 @@ sdmmc_mem_set_blocklen(struct sdmmc_softc *sc, struct sdmmc_function *sf)
{
struct sdmmc_command cmd;
+ SDMMC_ASSERT_LOCKED(sc);
+
bzero(&cmd, sizeof cmd);
cmd.c_opcode = MMC_SET_BLOCKLEN;
cmd.c_arg = sf->csd.sector_size;