Message ID | 1450295260-10980-4-git-send-email-Andrew.Baumann@microsoft.com |
---|---|
State | New |
Headers | show |
On Wed, Dec 16, 2015 at 11:47 AM, Andrew Baumann <Andrew.Baumann@microsoft.com> wrote: > This is needed for a quirk of the Raspberry Pi (bcm2835/6) MMC > controller, where the card insert bit is documented as unimplemented > (always reads zero, doesn't generate interrupts) but is in fact > observed on hardware as set at power on, but is cleared (and remains > clear) on subsequent controller resets. > Yep. Thats what the doc is saying. FWIW , that set-on-reset behaviour makes me very suspicious that this is the SoC layer or pin mux tying off this pin incorrectly. A bug in the pin-mux would cause exactly this symptom. Unfortunately we (or at least I) don't have access to Arasan's doc to tell if this this is SoC errata or SDHCI errata and the Broadcom doc quite unhelpfully refers the reader to: sd3.0_host_ahb_emmc4.4_usersguide_ver5.9_jan11_10.pdf Which doesn't google. > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> > --- > hw/sd/sdhci.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c > index dd83e89..61f919b 100644 > --- a/hw/sd/sdhci.c > +++ b/hw/sd/sdhci.c > @@ -193,7 +193,9 @@ static void sdhci_reset(SDHCIState *s) > * initialization */ > memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad); > > - sd_set_cb(s->card, s->ro_cb, s->eject_cb); > + if (!s->noeject_quirk) { > + sd_set_cb(s->card, s->ro_cb, s->eject_cb); > + } This will conflict with PMMs SD busification work but the resolution should be reasonably straightforward. The Busifed SDHCI can chose to ignore the inserted cb from the bus instead of the card. Regards, Peter > s->data_count = 0; > s->stopped_state = sdhc_not_stopped; > } > @@ -1208,6 +1210,7 @@ const VMStateDescription sdhci_vmstate = { > VMSTATE_UINT16(data_count, SDHCIState), > VMSTATE_UINT64(admasysaddr, SDHCIState), > VMSTATE_UINT8(stopped_state, SDHCIState), > + VMSTATE_BOOL(noeject_quirk, SDHCIState), > VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz), > VMSTATE_TIMER_PTR(insert_timer, SDHCIState), > VMSTATE_TIMER_PTR(transfer_timer, SDHCIState), > @@ -1276,6 +1279,7 @@ static Property sdhci_sysbus_properties[] = { > DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, > SDHC_CAPAB_REG_DEFAULT), > DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), > + DEFINE_PROP_BOOL("noeject-quirk", SDHCIState, noeject_quirk, false), > DEFINE_PROP_END_OF_LIST(), > }; > > -- > 2.5.3 >
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index dd83e89..61f919b 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -193,7 +193,9 @@ static void sdhci_reset(SDHCIState *s) * initialization */ memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad); - sd_set_cb(s->card, s->ro_cb, s->eject_cb); + if (!s->noeject_quirk) { + sd_set_cb(s->card, s->ro_cb, s->eject_cb); + } s->data_count = 0; s->stopped_state = sdhc_not_stopped; } @@ -1208,6 +1210,7 @@ const VMStateDescription sdhci_vmstate = { VMSTATE_UINT16(data_count, SDHCIState), VMSTATE_UINT64(admasysaddr, SDHCIState), VMSTATE_UINT8(stopped_state, SDHCIState), + VMSTATE_BOOL(noeject_quirk, SDHCIState), VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz), VMSTATE_TIMER_PTR(insert_timer, SDHCIState), VMSTATE_TIMER_PTR(transfer_timer, SDHCIState), @@ -1276,6 +1279,7 @@ static Property sdhci_sysbus_properties[] = { DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, SDHC_CAPAB_REG_DEFAULT), DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), + DEFINE_PROP_BOOL("noeject-quirk", SDHCIState, noeject_quirk, false), DEFINE_PROP_END_OF_LIST(), };
This is needed for a quirk of the Raspberry Pi (bcm2835/6) MMC controller, where the card insert bit is documented as unimplemented (always reads zero, doesn't generate interrupts) but is in fact observed on hardware as set at power on, but is cleared (and remains clear) on subsequent controller resets. Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> --- hw/sd/sdhci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)