Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/marvell Add check during mvsdio_attach that CMD line...



details:   https://anonhg.NetBSD.org/src/rev/f593796d5d0c
branches:  trunk
changeset: 822143:f593796d5d0c
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Mar 03 16:52:08 2017 +0000

description:
Add check during mvsdio_attach that CMD line is in idle state.

If the CMD line is not in idle state, the interrupt handler routine will
misbehave causing an endless interrupt handler loop.  This would prevent
the the kernel from getting to mountroot.

On my Pogoplug POGO-V4-A3-01, this was caused by U-Boot routing com1's TX
and RX signals to the SD card slot's CMD and DAT[0] lines respectively.

We should probably grow Marvell SoC MPP (pinmux) configuration frobs.

diffstat:

 sys/dev/marvell/mvsdio.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 97a2753147d0 -r f593796d5d0c sys/dev/marvell/mvsdio.c
--- a/sys/dev/marvell/mvsdio.c  Fri Mar 03 16:48:55 2017 +0000
+++ b/sys/dev/marvell/mvsdio.c  Fri Mar 03 16:52:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $      */
+/*     $NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $      */
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $");
 
 #include "opt_mvsdio.h"
 
@@ -157,6 +157,7 @@
        struct marvell_attach_args *mva = aux;
        struct sdmmcbus_attach_args saa;
        uint32_t nis, eis;
+       uint32_t hps;
 
        aprint_naive("\n");
        aprint_normal(": Marvell Secure Digital Input/Output Interface\n");
@@ -227,6 +228,13 @@
        bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISE, eis);
        bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISIE, eis);
 
+       hps = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVSDIO_HPS16LSB);
+       if ((hps & HPS16LSB_CMDLEVEL) == 0) {
+               aprint_error_dev(sc->sc_dev,
+                   "CMD line not idle, HPS 0x%x (bad MPP config?)\n", hps);
+               return;
+       }
+
         /*
         * Attach the generic SD/MMC bus driver.  (The bus driver must
         * not invoke any chipset functions before it is attached.)



Home | Main Index | Thread Index | Old Index