From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 19:08:54 2013 Return-Path: Delivered-To: svn-src-head@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 ESMTP id DB4F88EA; Sun, 18 Aug 2013 19:08:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 C905A26C7; Sun, 18 Aug 2013 19:08:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IJ8sGS006202; Sun, 18 Aug 2013 19:08:54 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IJ8sxR006193; Sun, 18 Aug 2013 19:08:54 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308181908.r7IJ8sxR006193@svn.freebsd.org> From: Ian Lepore Date: Sun, 18 Aug 2013 19:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254496 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2013 19:08:54 -0000 Author: ian Date: Sun Aug 18 19:08:53 2013 New Revision: 254496 URL: http://svnweb.freebsd.org/changeset/base/254496 Log: Add a new SDHCI_QUIRK_DONT_SHIFT_RESPONSE for hardware that pre-shifts the response bits the way we do in software. While the hardware is just doing the sensible thing rather than leaving it to the software, it's in violation of the spec by doing so. Grrrr. Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Aug 18 18:08:12 2013 (r254495) +++ head/sys/dev/sdhci/sdhci.c Sun Aug 18 19:08:53 2013 (r254496) @@ -835,8 +835,13 @@ sdhci_finish_command(struct sdhci_slot * uint8_t extra = 0; for (i = 0; i < 4; i++) { uint32_t val = RD4(slot, SDHCI_RESPONSE + i * 4); - slot->curcmd->resp[3 - i] = (val << 8) + extra; - extra = val >> 24; + if (slot->quirks & SDHCI_QUIRK_DONT_SHIFT_RESPONSE) + slot->curcmd->resp[3 - i] = val; + else { + slot->curcmd->resp[3 - i] = + (val << 8) | extra; + extra = val >> 24; + } } } else slot->curcmd->resp[0] = RD4(slot, SDHCI_RESPONSE); Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Sun Aug 18 18:08:12 2013 (r254495) +++ head/sys/dev/sdhci/sdhci.h Sun Aug 18 19:08:53 2013 (r254496) @@ -57,6 +57,8 @@ #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<11) /* SDHCI_CAPABILITIES is invalid */ #define SDHCI_QUIRK_MISSING_CAPS (1<<12) +/* Hardware shifts the 136-bit response, don't do it in software. */ +#define SDHCI_QUIRK_DONT_SHIFT_RESPONSE (1<<13) /* * Controller registers