From patchwork Wed Sep 3 02:08:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4829721 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 BF70B9F2ED for ; Wed, 3 Sep 2014 02:09:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD4C9201EF for ; Wed, 3 Sep 2014 02:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE211201E4 for ; Wed, 3 Sep 2014 02:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbaICCI4 (ORCPT ); Tue, 2 Sep 2014 22:08:56 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:43029 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752562AbaICCIy (ORCPT ); Tue, 2 Sep 2014 22:08:54 -0400 Received: by mail-pa0-f46.google.com with SMTP id eu11so16177136pac.19 for ; Tue, 02 Sep 2014 19:08:53 -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:mime-version:to:cc :in-reply-to:references:content-type; bh=A5p7C8fbF5Md4bLk3APZ/y6CH5LuLsj+DavUDbaDehM=; b=nnYr3fvnK/Rj1b4Ipp5pIzkqqIhfG+Mr/+JBDAzcTMV0NCRh40zPXtd1Qu6ZqpAJi5 odZKBD3nsh0Tn6MDujhZ0Lc68pP4LrIZzWsA7XY09vtnuq4DqWmk/lP1yB2Y3GwEnGyK JnUkFodHjnL7x61nQ3st0jkfDWZTeidwDG5tp9DeLJ4jb008QKEdrYi/6eFuOecNkYaw cGgsdS1ei432TSKEXlTI62Q/N7Qf7/lfW9b3e2uiD93z0B4giscHwemkV6TeLY0W2PYd VVOs4DS8DLrT5QnrCP7ziWg5MX8z6kkyLi2Q2I7vS5upmno/CLaYfonibFmm1LC8rzWh UL2g== X-Received: by 10.70.88.237 with SMTP id bj13mr52812990pdb.57.1409710133817; Tue, 02 Sep 2014 19:08:53 -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 rk2sm5339858pbc.1.2014.09.02.19.08.52 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 02 Sep 2014 19:08:53 -0700 (PDT) Date: Tue, 02 Sep 2014 19:08:53 -0700 (PDT) Message-ID: <87a96h78wd.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto Subject: [PATCH 1/7 v3] mmc: add .multi_io_quirk callback for multi I/O HW bug User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") To: Ulf Hansson , Chris Ball , Simon Cc: Kuninori Morimoto , Linux-SH , linux-mmc In-Reply-To: <87bnqx78xr.wl%kuninori.morimoto.gx@gmail.com> References: <87r3zvzohj.wl%kuninori.morimoto.gx@gmail.com> <87bnqx78xr.wl%kuninori.morimoto.gx@gmail.com> 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.5 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 Historically, we have been using MMC_CAP* to solve some issues, and current mmc block.c has MMC_CAP2_NO_MULTI_READ flag for multi I/O HW bug workaround. But it should be implemented under driver, not framework. This patch is prepare for it Signed-off-by: Kuninori Morimoto --- v2 -> v3 - blk_size_workaround -> multi_io_quirk - fixup comment/explain - use MMC_DATA_READ/WRITE drivers/mmc/card/block.c | 10 ++++++++++ include/linux/mmc/host.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index ede41f0..adab903 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1402,6 +1402,16 @@ 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 have HW issues while operating + * in multiple I/O mode + */ + if (card->host->ops->multi_io_quirk) + brq->data.blocks = card->host->ops->multi_io_quirk(card, + (rq_data_dir(req) == READ) ? + MMC_DATA_READ : MMC_DATA_WRITE, + 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..bfcf673 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -139,6 +139,13 @@ 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 to support controllers with HW issues for multiple I/O. + * Returns the number of supported blocks for the request + */ + int (*multi_io_quirk)(struct mmc_card *card, + unsigned int direction, int blk_size); }; struct mmc_card;