From owner-svn-src-all@FreeBSD.ORG Sun Feb 16 17:22:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D76964B; Sun, 16 Feb 2014 17:22:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2F88A1E1F; Sun, 16 Feb 2014 17:22:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1GHMoDO048511; Sun, 16 Feb 2014 17:22:50 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1GHMom6048510; Sun, 16 Feb 2014 17:22:50 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201402161722.s1GHMom6048510@svn.freebsd.org> From: Ian Lepore Date: Sun, 16 Feb 2014 17:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261983 - head/sys/dev/sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Feb 2014 17:22:50 -0000 Author: ian Date: Sun Feb 16 17:22:49 2014 New Revision: 261983 URL: http://svnweb.freebsd.org/changeset/base/261983 Log: After a timeout, reset the controller using SDHCI_RESET_CMD|SDHCI_RESET_DATA rather than SDHCI_RESET_ALL; the latter turns off clocks and power, removing any possibility of recovering from the error. Also, double the timeout to 2 seconds. Despite what the SD spec says about all transactions completing in 250ms or less, I have a card which sometimes takes more than a second to complete a write. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Feb 16 16:49:54 2014 (r261982) +++ head/sys/dev/sdhci/sdhci.c Sun Feb 16 17:22:49 2014 (r261983) @@ -725,7 +725,7 @@ sdhci_timeout(void *arg) struct sdhci_slot *slot = arg; if (slot->curcmd != NULL) { - sdhci_reset(slot, SDHCI_RESET_ALL); + sdhci_reset(slot, SDHCI_RESET_CMD|SDHCI_RESET_DATA); slot->curcmd->error = MMC_ERR_TIMEOUT; sdhci_req_done(slot); } @@ -850,8 +850,8 @@ sdhci_start_command(struct sdhci_slot *s sdhci_set_transfer_mode(slot, cmd->data); /* Start command. */ WR2(slot, SDHCI_COMMAND_FLAGS, (cmd->opcode << 8) | (flags & 0xff)); - /* Start timeout callout; no command should take more than a second. */ - callout_reset(&slot->timeout_callout, hz, sdhci_timeout, slot); + /* Start timeout callout. */ + callout_reset(&slot->timeout_callout, 2*hz, sdhci_timeout, slot); } static void