From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBIj5-0002YQ-J1 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBIj0-0007nA-Un for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBIj0-0007n6-Ok for qemu-devel@nongnu.org; Tue, 22 Dec 2015 03:55:18 -0500 From: Stefan Hajnoczi Date: Tue, 22 Dec 2015 16:54:18 +0800 Message-Id: <1450774460-17259-9-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> Subject: [Qemu-devel] [PULL 08/10] 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 , Stefan Hajnoczi , Andrew Baumann , Peter Crosthwaite From: Peter Crosthwaite 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 Raspberry Pi, 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 Message-id: 1450738069-18664-2-git-send-email-Andrew.Baumann@microsoft.com [AB: Add Pi to list of devices fixed in commit message] Signed-off-by: Andrew Baumann Signed-off-by: Stefan Hajnoczi --- 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.0