Wed Sep 9 08:06:47 2015 UTC ()
Don't test flags from error value in status value. Instead test the
error interrupt status.


(mlelstv)
diff -r1.85 -r1.86 src/sys/dev/sdmmc/sdhc.c

cvs diff -r1.85 -r1.86 src/sys/dev/sdmmc/sdhc.c (expand / switch to unified diff)

--- src/sys/dev/sdmmc/sdhc.c 2015/09/09 08:04:33 1.85
+++ src/sys/dev/sdmmc/sdhc.c 2015/09/09 08:06:47 1.86
@@ -1,39 +1,39 @@ @@ -1,39 +1,39 @@
1/* $NetBSD: sdhc.c,v 1.85 2015/09/09 08:04:33 mlelstv Exp $ */ 1/* $NetBSD: sdhc.c,v 1.86 2015/09/09 08:06:47 mlelstv Exp $ */
2/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ 2/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> 5 * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */ 18 */
19 19
20/* 20/*
21 * SD Host Controller driver based on the SD Host Controller Standard 21 * SD Host Controller driver based on the SD Host Controller Standard
22 * Simplified Specification Version 1.00 (www.sdcard.com). 22 * Simplified Specification Version 1.00 (www.sdcard.com).
23 */ 23 */
24 24
25#include <sys/cdefs.h> 25#include <sys/cdefs.h>
26__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.85 2015/09/09 08:04:33 mlelstv Exp $"); 26__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.86 2015/09/09 08:06:47 mlelstv Exp $");
27 27
28#ifdef _KERNEL_OPT 28#ifdef _KERNEL_OPT
29#include "opt_sdmmc.h" 29#include "opt_sdmmc.h"
30#endif 30#endif
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/device.h> 33#include <sys/device.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/malloc.h> 35#include <sys/malloc.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/condvar.h> 38#include <sys/condvar.h>
39#include <sys/atomic.h> 39#include <sys/atomic.h>
@@ -2213,28 +2213,27 @@ sdhc_intr(void *arg) @@ -2213,28 +2213,27 @@ sdhc_intr(void *arg)
2213 } 2213 }
2214 2214
2215 /* 2215 /*
2216 * Schedule re-tuning process (UHS). 2216 * Schedule re-tuning process (UHS).
2217 */ 2217 */
2218 if (ISSET(status, SDHC_RETUNING_EVENT)) { 2218 if (ISSET(status, SDHC_RETUNING_EVENT)) {
2219 atomic_swap_uint(&hp->tuning_timer_pending, 1); 2219 atomic_swap_uint(&hp->tuning_timer_pending, 1);
2220 } 2220 }
2221 2221
2222 /* 2222 /*
2223 * Wake up the blocking process to service command 2223 * Wake up the blocking process to service command
2224 * related interrupt(s). 2224 * related interrupt(s).
2225 */ 2225 */
2226 if (ISSET(status, SDHC_COMMAND_COMPLETE| 2226 if (ISSET(status, SDHC_COMMAND_COMPLETE|SDHC_ERROR_INTERRUPT|
2227 SDHC_CMD_TIMEOUT_ERROR|SDHC_DATA_TIMEOUT_ERROR| 
2228 SDHC_BUFFER_READ_READY|SDHC_BUFFER_WRITE_READY| 2227 SDHC_BUFFER_READ_READY|SDHC_BUFFER_WRITE_READY|
2229 SDHC_TRANSFER_COMPLETE|SDHC_DMA_INTERRUPT)) { 2228 SDHC_TRANSFER_COMPLETE|SDHC_DMA_INTERRUPT)) {
2230 hp->intr_error_status |= error; 2229 hp->intr_error_status |= error;
2231 hp->intr_status |= status; 2230 hp->intr_status |= status;
2232 if (ISSET(sc->sc_flags, SDHC_FLAG_ENHANCED)) { 2231 if (ISSET(sc->sc_flags, SDHC_FLAG_ENHANCED)) {
2233 HCLR4(hp, SDHC_NINTR_SIGNAL_EN, 2232 HCLR4(hp, SDHC_NINTR_SIGNAL_EN,
2234 status & (SDHC_BUFFER_READ_READY|SDHC_BUFFER_WRITE_READY)); 2233 status & (SDHC_BUFFER_READ_READY|SDHC_BUFFER_WRITE_READY));
2235 } 2234 }
2236 cv_broadcast(&hp->intr_cv); 2235 cv_broadcast(&hp->intr_cv);
2237 } 2236 }
2238 2237
2239 /* 2238 /*
2240 * Service SD card interrupts. 2239 * Service SD card interrupts.