Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc No need to panic on failure to find a divisor.
details: https://anonhg.NetBSD.org/src/rev/d38ad54a6268
branches: trunk
changeset: 780130:d38ad54a6268
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Thu Jul 12 17:15:27 2012 +0000
description:
No need to panic on failure to find a divisor.
Additionally, add commented out calculation of actual clock frequency.
diffstat:
sys/dev/sdmmc/sdhc.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (49 lines):
diff -r 98842f0ac35a -r d38ad54a6268 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Thu Jul 12 17:14:39 2012 +0000
+++ b/sys/dev/sdmmc/sdhc.c Thu Jul 12 17:15:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch Exp $ */
+/* $NetBSD: sdhc.c,v 1.18 2012/07/12 17:15:27 jakllsch Exp $ */
/* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.18 2012/07/12 17:15:27 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -721,6 +721,7 @@
*divp = SDHC_SDCLK_CGM
| ((div & 0x300) << SDHC_SDCLK_XDIV_SHIFT)
| ((div & 0x0ff) << SDHC_SDCLK_DIV_SHIFT);
+ //freq = hp->clkbase / div;
return true;
}
}
@@ -738,6 +739,7 @@
DPRINTF(2,
("%s: divisor for freq %u is %u * %u\n",
HDEVNAME(hp), freq, div * 2, dvs + 1));
+ //freq = hp->clkbase / (div * 2) * (dvs + 1);
return true;
}
/*
@@ -745,11 +747,13 @@
*/
roundup |= dvs & 1;
}
- panic("%s: can't find divisor for freq %u", HDEVNAME(hp), freq);
+ /* No divisor found. */
+ return false;
} else {
for (div = 1; div <= 256; div *= 2) {
if ((hp->clkbase / div) <= freq) {
*divp = (div / 2) << SDHC_SDCLK_DIV_SHIFT;
+ //freq = hp->clkbase / div;
return true;
}
}
Home |
Main Index |
Thread Index |
Old Index