From patchwork Tue Sep 2 02:01:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4822451 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 5623F9F2ED for ; Tue, 2 Sep 2014 02:01:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8558420172 for ; Tue, 2 Sep 2014 02:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE33F20170 for ; Tue, 2 Sep 2014 02:01:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751405AbaIBCBK (ORCPT ); Mon, 1 Sep 2014 22:01:10 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:44560 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbaIBCBJ (ORCPT ); Mon, 1 Sep 2014 22:01:09 -0400 Received: by mail-pd0-f176.google.com with SMTP id g10so7267906pdj.35 for ; Mon, 01 Sep 2014 19:01:08 -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=oiks1sDpMjzi+anyw6lBnCrVUB53coWOHGMKQVE7OpA=; b=IYudQd3IAeVdxmQyplxe2wKNQ7JeMZlDIr12WgoWL/oNTB1b4eBDe2dmoWOaMTBYrc xi7yElOr0bTE7Xgjx3Cw8hqgjmAnj9pUHqZYqQlHSvaRS1MycMm57ZjXzggbYyR6zP5r wBxGVFBuZfBMiVzM1C3CrdKIdmFH72HTdItn6VqupZ8bcwB46HWsjOCbkiV4vVruFb6e HpNJBQuxIw/O0jtzIgj/1ucjzqqYloIRs5h+PpoKv5Nk2Zh23VKynt/EnTDKaPlq+Yry 3MiS+XgXIOc0uI99+Wkw6AbwIOiaDc98N1Sm3KWuSHEWrmTU1mwGYteSp8VdkE/rKeOj RUxA== X-Received: by 10.70.35.67 with SMTP id f3mr3361273pdj.34.1409623268883; Mon, 01 Sep 2014 19:01:08 -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 rd2sm2242802pbc.45.2014.09.01.19.01.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 19:01:08 -0700 (PDT) Date: Mon, 01 Sep 2014 19:01:08 -0700 (PDT) Message-ID: <87k35mkcgu.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 1/7 v2] 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: <87lhq2kcif.wl%kuninori.morimoto.gx@gmail.com> References: <87r3zvzohj.wl%kuninori.morimoto.gx@gmail.com> <87lhq2kcif.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 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 --- v1 -> v2 - no change 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;