From patchwork Mon Sep 1 09:20:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4817951 Return-Path: X-Original-To: patchwork-linux-mmc@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 581F59F2ED for ; Mon, 1 Sep 2014 09:21:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97F9F200EC for ; Mon, 1 Sep 2014 09:21:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CAB320148 for ; Mon, 1 Sep 2014 09:21:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752747AbaIAJU7 (ORCPT ); Mon, 1 Sep 2014 05:20:59 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:45714 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752722AbaIAJU7 (ORCPT ); Mon, 1 Sep 2014 05:20:59 -0400 Received: by mail-pa0-f49.google.com with SMTP id kq14so11829905pab.36 for ; Mon, 01 Sep 2014 02:20:58 -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=2rH7+ACSc6GmeMNd34JDkH8jkFfO3GU03vRjMejNauc=; b=uP+EHVadnlRYzFgZWwRDURgw91wDH8TbKTS+yBDN7IFWCKnz+xR7+c0G6ZUd6yvDvb jlbTmSM2wnIHYiocbyufyG9wX1LE826lJ8q9oAZzjYlfneRPTAdEfRngtENSFK9csNj8 eS5+wB21QYQFPuFUXA2/9xMOxFd2e5LZrZJsDmFd26lC/+wvbs8tV0hs07/b0azsG3tu SmSrrftjb3L79PXDYXMve+bHCsZA8hw1Zg+DHjh9bHxLwbGPwcXFfkCHU4bGWOa9vPH8 WpMH2TjQKorzHgDeRAkT5UJiNjse00bQM7JeN7h+ItoSn1PQZH7SHDAkvfUM1nx5eHuS kuuA== X-Received: by 10.68.229.166 with SMTP id sr6mr37679362pbc.33.1409563258673; Mon, 01 Sep 2014 02:20:58 -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 k1sm484479pdj.8.2014.09.01.02.20.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 02:20:58 -0700 (PDT) Date: Mon, 01 Sep 2014 02:20:58 -0700 (PDT) Message-ID: <87ppffzog7.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 1/7] mmc: add blk_size_workaround for HW bug 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-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@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 Current mmc block.c has MMC_CAP2_NO_MULTI_READ flag for HW bug workaround, but it should be implemented under driver, not framework. This patch is prepare for it Signed-off-by: Kuninori Morimoto --- drivers/mmc/card/block.c | 5 +++++ include/linux/mmc/host.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index ede41f0..e946067 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1402,6 +1402,11 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, if (card->host->caps2 & MMC_CAP2_NO_MULTI_READ && rq_data_dir(req) == READ) brq->data.blocks = 1; + + /* Some controllers needs workaround */ + if (card->host->ops->blk_size_workaround) + brq->data.blocks = card->host->ops->blk_size_workaround( + card, req, brq->data.blocks); } if (brq->data.blocks > 1 || do_rel_wr) { diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4cbf614..95bd903 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -139,6 +139,10 @@ struct mmc_host_ops { int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); void (*hw_reset)(struct mmc_host *host); void (*card_event)(struct mmc_host *host); + + /* optional callback for mmc block HW bug workaround */ + int (*blk_size_workaround)(struct mmc_card *card, + struct request *req, int blk_size); }; struct mmc_card;