Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/sunxi honour non-removable and broken-cd proper...
details: https://anonhg.NetBSD.org/src/rev/0ea78c6c1096
branches: trunk
changeset: 357568:0ea78c6c1096
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Nov 15 13:53:26 2017 +0000
description:
honour non-removable and broken-cd properties
diffstat:
sys/arch/arm/sunxi/sunxi_mmc.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diffs (68 lines):
diff -r 152c2f632730 -r 0ea78c6c1096 sys/arch/arm/sunxi/sunxi_mmc.c
--- a/sys/arch/arm/sunxi/sunxi_mmc.c Wed Nov 15 10:42:41 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_mmc.c Wed Nov 15 13:53:26 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.16 2017/10/28 13:13:45 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.17 2017/11/15 13:53:26 jmcneill Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_sunximmc.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.16 2017/10/28 13:13:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.17 2017/11/15 13:53:26 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -188,6 +188,9 @@
struct fdtbus_regulator *sc_reg_vqmmc;
struct fdtbus_mmc_pwrseq *sc_pwrseq;
+
+ bool sc_non_removable;
+ bool sc_broken_cd;
};
CFATTACH_DECL_NEW(sunxi_mmc, sizeof(struct sunxi_mmc_softc),
@@ -334,6 +337,9 @@
sc->sc_gpio_cd_inverted = of_hasprop(phandle, "cd-inverted") ? 0 : 1;
sc->sc_gpio_wp_inverted = of_hasprop(phandle, "wp-inverted") ? 0 : 1;
+ sc->sc_non_removable = of_hasprop(phandle, "non-removable");
+ sc->sc_broken_cd = of_hasprop(phandle, "broken-cd");
+
if (sunxi_mmc_dmabounce_setup(sc) != 0 ||
sunxi_mmc_idma_setup(sc) != 0) {
aprint_error_dev(self, "failed to setup DMA\n");
@@ -638,9 +644,14 @@
{
struct sunxi_mmc_softc *sc = sch;
- if (sc->sc_gpio_cd == NULL) {
- return 1; /* no card detect pin, assume present */
- } else {
+ if (sc->sc_non_removable || sc->sc_broken_cd) {
+ /*
+ * Non-removable or broken card detect flag set in
+ * DT, assume always present
+ */
+ return 1;
+ } else if (sc->sc_gpio_cd != NULL) {
+ /* Use card detect GPIO */
int v = 0, i;
for (i = 0; i < 5; i++) {
v += (fdtbus_gpio_read(sc->sc_gpio_cd) ^
@@ -652,6 +663,11 @@
else if (v == 0)
sc->sc_mmc_present = 1;
return sc->sc_mmc_present;
+ } else {
+ /* Use CARD_PRESENT field of SD_STATUS register */
+ const uint32_t present = MMC_READ(sc, SUNXI_MMC_STATUS) &
+ SUNXI_MMC_STATUS_CARD_PRESENT;
+ return present != 0;
}
}
Home |
Main Index |
Thread Index |
Old Index