From patchwork Mon Aug 7 16:01:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 9885739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2937360363 for ; Mon, 7 Aug 2017 16:04:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B40926E3A for ; Mon, 7 Aug 2017 16:04:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FB0F274A3; Mon, 7 Aug 2017 16:04:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7F9F26E3A for ; Mon, 7 Aug 2017 16:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751493AbdHGQDD (ORCPT ); Mon, 7 Aug 2017 12:03:03 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:38812 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752069AbdHGQCw (ORCPT ); Mon, 7 Aug 2017 12:02:52 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v77G1vMd015879; Mon, 7 Aug 2017 11:01:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1502121717; bh=Ki6+FdRFUvsHMF2Sax6Qb3mgULuQYPqhD/epVjM51lo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=duwUxG86B3d3YHc7/Kzlm475rmzz5GOcclZE7obtvzF/wqDGjUbwsSyMM3iZ8xZ6W W9IEG2QYp2lVcgLObVPLdilVDWTlED2M4vFPswyhSpwaqn+SPxNcFr9cWQCuh5RhX2 +gSu+BcNZOSTlKdTHvBKLojCGKuofQpcGO831yRE= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v77G1qBg030291; Mon, 7 Aug 2017 11:01:52 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Mon, 7 Aug 2017 11:01:52 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v77G1jGr023497; Mon, 7 Aug 2017 11:01:49 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Rob Herring , Adrian Hunter CC: , , , , , Subject: [RFC PATCH 1/7] mmc: sdhci: Add quirk to indicate no CRC stripping in MMC_RSP_136 Date: Mon, 7 Aug 2017 21:31:36 +0530 Message-ID: <20170807160142.12134-2-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170807160142.12134-1-kishon@ti.com> References: <20170807160142.12134-1-kishon@ti.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP TI's implementation of sdhci controller used in DRA7 SoC's doesn't strip CRC in responses with length 136 bits. Add quirk to indicate the controller does not strip CRC in MMC_RSP_136. If this quirk is set sdhci library shouldn't shift the response present in SDHCI_RESPONSE register. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/sdhci.c | 27 +++++++++++++++++++-------- drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ecd0d4350e8a..ece3751d2a25 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1182,14 +1182,25 @@ static void sdhci_finish_command(struct sdhci_host *host) if (cmd->flags & MMC_RSP_PRESENT) { if (cmd->flags & MMC_RSP_136) { - /* CRC is stripped so we need to do some shifting. */ - for (i = 0;i < 4;i++) { - cmd->resp[i] = sdhci_readl(host, - SDHCI_RESPONSE + (3-i)*4) << 8; - if (i != 3) - cmd->resp[i] |= - sdhci_readb(host, - SDHCI_RESPONSE + (3-i)*4-1); + if (!(host->quirks2 & SDHCI_QUIRK2_NO_CRC_STRIPPING)) { + /* + * CRC is stripped so we need to do some + * shifting. + */ + for (i = 0; i < 4; i++) { + cmd->resp[i] = + sdhci_readl(host, SDHCI_RESPONSE + + (3 - i) * 4) << 8; + if (i != 3) + cmd->resp[i] |= + sdhci_readb(host, SDHCI_RESPONSE + + (3 - i) * 4 - 1); + } + } else { + for (i = 0; i < 4; i++) + cmd->resp[i] = + sdhci_readl(host, SDHCI_RESPONSE + + (3 - i) * 4); } } else { cmd->resp[0] = sdhci_readl(host, SDHCI_RESPONSE); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0469fa191493..6905131f603d 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -435,6 +435,8 @@ struct sdhci_host { #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) /* Broken Clock divider zero in controller */ #define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) +/* Controller does not have CRC stripped in Command Response */ +#define SDHCI_QUIRK2_NO_CRC_STRIPPING (1<<16) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */