From patchwork Tue Dec 22 08:54:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 559928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4131B140BA1 for ; Tue, 22 Dec 2015 19:59:56 +1100 (AEDT) Received: from localhost ([::1]:49342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBInR-0001b1-Sn for incoming@patchwork.ozlabs.org; Tue, 22 Dec 2015 03:59:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBIjI-00030K-9Q for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBIjD-0007qc-8e for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBIjD-0007qN-40 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:31 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id AED2B8CF6F; Tue, 22 Dec 2015 08:55:30 +0000 (UTC) Received: from localhost (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBM8tRIW002247; Tue, 22 Dec 2015 03:55:29 -0500 From: Stefan Hajnoczi To: Date: Tue, 22 Dec 2015 16:54:20 +0800 Message-Id: <1450774460-17259-11-git-send-email-stefanha@redhat.com> In-Reply-To: <1450774460-17259-1-git-send-email-stefanha@redhat.com> References: <1450774460-17259-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi , Andrew Baumann Subject: [Qemu-devel] [PULL 10/10] sdhci: add optional quirk property to disable card insertion/removal interrupts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Andrew Baumann 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 Reviewed-by: Peter Crosthwaite Message-id: 1450738069-18664-4-git-send-email-Andrew.Baumann@microsoft.com Signed-off-by: Stefan Hajnoczi --- hw/sd/sdhci.c | 5 ++++- include/hw/sd/sdhci.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index dd83e89..7acb4d7 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; } @@ -1276,6 +1278,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(), }; diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h index e78d938..ffd1f80 100644 --- a/include/hw/sd/sdhci.h +++ b/include/hw/sd/sdhci.h @@ -77,6 +77,7 @@ typedef struct SDHCIState { uint32_t buf_maxsz; uint16_t data_count; /* current element in FIFO buffer */ uint8_t stopped_state;/* Current SDHC state */ + bool noeject_quirk;/* Quirk to disable card insert/remove interrupts */ /* Buffer Data Port Register - virtual access point to R and W buffers */ /* Software Reset Register - always reads as 0 */ /* Force Event Auto CMD12 Error Interrupt Reg - write only */