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.
This commit is contained in:
jakllsch 2017-03-03 16:52:08 +00:00
parent 3b864806d6
commit c634706878
1 changed files with 10 additions and 2 deletions

View File

@ -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 @@ mvsdio_attach(device_t parent, device_t self, void *aux)
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 @@ mvsdio_attach(device_t parent, device_t self, void *aux)
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.)