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: 109578 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1785708qge; Mon, 7 Aug 2017 09:03:06 -0700 (PDT) X-Received: by 10.99.7.131 with SMTP id 125mr990635pgh.136.1502121786175; Mon, 07 Aug 2017 09:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502121786; cv=none; d=google.com; s=arc-20160816; b=ggrGp380pXeMsb7htKqqFKvSqbb7auJ7/Z14HTby0ZuVtp6KnmEhbBTPXtP4BZHEgy kIaRk/uQIX9/Wpjtc5LMlwXbLHgtnlLq6QG0UsxUY7Lnrx5XmhJYdmMH/AGTcvIRdSQC 7xCv/wCeOLgPGWJyvgivoYLdSv2rTxRTWumpv5BwV8LdlivvtBoqwzaVapAFPiBDbQBt pGHRcjv8MzDoPOZV0pe4DuR3rVZyPROzkJb8xsGD/YGihx6iCCLwEZfan9k9+s7Ub1X4 JLVHBVxeBlrvnzFlXbjhUQcnXnOj66roE0nz9yE/I5WTUVTTRRxifyBtzycFoo/zwQlW 3Qow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=GuVYnq4rGnI9XTAbDLLM+5PJRJjrHxVP5so1BuhG/dk=; b=iFxZ8M63oNNCkh30+utUasedVFPlMq3RkLgq5UfbgQ4n5r3hXVLsw6V2sobhB6v/Zi Nop3U4zWBCpT1vvs00zXzJ54E1WJC+nule1DB7e8HxTdkMBuhAdws9w1tgs+RAmb+h98 eE2akUL6LiXGbi0TUWOlpPPumdGAQzLG8lIKCTCCgtz5/ed2a4Qwc+qrPhRQsdtkdRRz /nTaeWcWuj4r24Ibq8E6KbDce9u+7fzBTynWJeKptSchWO+VE630Ygs6inZo4RtWSnEg D2cNO5ieq9lwDLbn28ZGv/70ORdosO9RoQYNN1FVhsU847R2caZwDcy1w7a1bAF42gD4 6iuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.b=duwUxG86; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si1214608pgb.915.2017.08.07.09.03.05; Mon, 07 Aug 2017 09:03:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.b=duwUxG86; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbdHGQDD (ORCPT + 25 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.11.0 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 */