From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9I3R-0000HU-QS for qemu-devel@nongnu.org; Wed, 16 Dec 2015 14:48:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9I3N-0007EC-Kc for qemu-devel@nongnu.org; Wed, 16 Dec 2015 14:48:05 -0500 Received: from mail-bn1bon0114.outbound.protection.outlook.com ([157.56.111.114]:53472 helo=na01-bn1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9I3N-0007Dr-G7 for qemu-devel@nongnu.org; Wed, 16 Dec 2015 14:48:01 -0500 From: Andrew Baumann Date: Wed, 16 Dec 2015 11:47:38 -0800 Message-ID: <1450295260-10980-2-git-send-email-Andrew.Baumann@microsoft.com> In-Reply-To: <1450295260-10980-1-git-send-email-Andrew.Baumann@microsoft.com> References: <1450295260-10980-1-git-send-email-Andrew.Baumann@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 1/3] sd: sdhci: Delete over-zealous power check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Crosthwaite , Igor Mitsyanko , Andrew Baumann , Peter Crosthwaite , Stefan Hajnoczi This check was conditionalising SD card operation on the card being powered by the SDHCI host controller. It is however possible (particularly in embedded systems) for the power control of the SD card to be managed outside of SDHCI. This can be as trivial as hard-wiring the SD slot VCC to a constant power-rail. This means the guest SDHCI can validly opt-out of the SDHCI power control feature while still using the card. So delete this check to allow operation of the card with SDHCI power control. This is needed for at least Xilinx Zynq and also makes Freescale i.MX25 work for me. The digilent Zybo board has a public schematic which shows SD VCC hardwiring: http://digilentinc.com/Data/Products/ZYBO/ZYBO_sch_VB.3.pdf bottom of page 3. Signed-off-by: Peter Crosthwaite Reviewed-by: Sai Pavan Boddu Signed-off-by: Andrew Baumann --- Notes: This is exactly equivalent to Peter's patch here: https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg06271.html ... which is why I've copied the signed-off-by lines (I assume that is legit; if not, my apologies!). It is also needed for Pi. hw/sd/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 8612760..bc39d48 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -831,7 +831,7 @@ static void sdhci_data_transfer(void *opaque) static bool sdhci_can_issue_command(SDHCIState *s) { - if (!SDHC_CLOCK_IS_ON(s->clkcon) || !(s->pwrcon & SDHC_POWER_ON) || + if (!SDHC_CLOCK_IS_ON(s->clkcon) || (((s->prnsts & SDHC_DATA_INHIBIT) || s->stopped_state) && ((s->cmdreg & SDHC_CMD_DATA_PRESENT) || ((s->cmdreg & SDHC_CMD_RESPONSE) == SDHC_CMD_RSP_WITH_BUSY && -- 2.5.3