From patchwork Mon Sep 1 09:22:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4818011 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 568CC9F2ED for ; Mon, 1 Sep 2014 09:22:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8238320148 for ; Mon, 1 Sep 2014 09:22:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F33FE2015A for ; Mon, 1 Sep 2014 09:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753120AbaIAJWV (ORCPT ); Mon, 1 Sep 2014 05:22:21 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:59003 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbaIAJWU (ORCPT ); Mon, 1 Sep 2014 05:22:20 -0400 Received: by mail-pa0-f45.google.com with SMTP id bj1so11819523pad.18 for ; Mon, 01 Sep 2014 02:22:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=ZGyWdSN784KvQYuEAC8NCzwJj9x4p0HrC/FcwIgDQII=; b=N0PGX1fjJ7jaox98aWkGUk9ap+CMwn39HUCQCZLWNi4osR7lzl9mI4QBUzwGZk+sch /YxhXqMldNHP/MmN3SPM8o+oTDVha+F2a98E8k31LXqtXHDO5pY4360MuGgCl+3y4Ycl 7g9m6FqYq0yhePiQAyDfih0pCX7OdBGdJndOfSb+feZw2A0Q8JHiPyfh8mo3gD9/XQAL W7gZlo73523W5/ixj0OIiSLorjJXxQ4C0mpfp1GHVPZ+1rvUKVkbNYJwERrwrbj7lEAU WBYiYoUdoW10jV/WdlVSAekLdP+OhOPBmxHif+VsxrfFYEDzbi/V1onKrEoKZ4Q1I7yl SIyA== X-Received: by 10.66.139.36 with SMTP id qv4mr37894665pab.53.1409563336966; Mon, 01 Sep 2014 02:22:16 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id o2sm337674pdk.87.2014.09.01.02.22.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 02:22:16 -0700 (PDT) Date: Mon, 01 Sep 2014 02:22:16 -0700 (PDT) Message-ID: <87lhq3zoe3.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 4/7] mmc: sh_mobile_sdhi: use blk_size_workaround User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Ulf Hansson , Chris Ball , Simon Cc: Kuninori Morimoto , Linux-SH , linux-mmc In-Reply-To: <87r3zvzohj.wl%kuninori.morimoto.gx@gmail.com> References: <87r3zvzohj.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Now, sh_mobile_sdhi can use blk_size_workaround instead of MMC_CAP2_NO_MULTI_READ. let's use it. Signed-off-by: Kuninori Morimoto --- drivers/mmc/host/sh_mobile_sdhi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index d5d4937..5c44e77 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -58,7 +58,6 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = { .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_CLK_ACTUAL, .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, - .capabilities2 = MMC_CAP2_NO_MULTI_READ, .dma_rx_offset = 0x2000, }; @@ -136,6 +135,24 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) return 0; } +static int sh_mobile_blk_size_workaround(struct mmc_card *card, + struct request *req, int blk_size) +{ + /* + * In Renesas controllers, when performing a + * multiple block read of one or two blocks, + * depending on the timing with which the + * response register is read, the response + * value may not be read properly. + * Use single block read for this HW bug + */ + if ((rq_data_dir(req) == READ) && + blk_size == 2) + return 1; + + return blk_size; +} + static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev) { mmc_detect_change(platform_get_drvdata(pdev), msecs_to_jiffies(100)); @@ -191,6 +208,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) mmc_data->clk_disable = sh_mobile_sdhi_clk_disable; mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; mmc_data->write16_hook = sh_mobile_sdhi_write16_hook; + mmc_data->blk_size_workaround = sh_mobile_blk_size_workaround; if (p) { mmc_data->flags = p->tmio_flags; mmc_data->ocr_mask = p->tmio_ocr_mask;