From patchwork Fri Feb 18 13:39:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 168 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:31 -0000 Delivered-To: patches@linaro.org Received: by 10.146.25.23 with SMTP id 23cs95562yay; Fri, 18 Feb 2011 05:39:05 -0800 (PST) Received: by 10.216.143.17 with SMTP id k17mr1488685wej.74.1298036344439; Fri, 18 Feb 2011 05:39:04 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id l76si3118263wej.7.2011.02.18.05.39.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Feb 2011 05:39:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1PqQY0-0002xi-P3; Fri, 18 Feb 2011 13:39:00 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH] hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS Date: Fri, 18 Feb 2011 13:39:00 +0000 Message-Id: <1298036340-11363-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.3 The SD_STATUS and SEND_NUM_WR_BLOCKS commands are supposed to cause the card to send data back to the host. However sd.c was missing the state change to sd_sendingdata_state for these commands, with the effect that the Linux driver would either hang indefinitely waiting for nonexistent data (pl181) or read zeroes and provoke a qemu warning message (omap). Signed-off-by: Peter Maydell --- hw/sd.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/hw/sd.c b/hw/sd.c index 789ca84..5e29752 100644 --- a/hw/sd.c +++ b/hw/sd.c @@ -1168,6 +1168,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, case 13: /* ACMD13: SD_STATUS */ switch (sd->state) { case sd_transfer_state: + sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; @@ -1182,6 +1183,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd, case sd_transfer_state: *(uint32_t *) sd->data = sd->blk_written; + sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1;