From patchwork Fri Jul 6 08:44:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 1164291 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 537D2DF236 for ; Fri, 6 Jul 2012 09:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750946Ab2GFJmI (ORCPT ); Fri, 6 Jul 2012 05:42:08 -0400 Received: from eu1sys200aog116.obsmtp.com ([207.126.144.141]:38825 "EHLO eu1sys200aog116.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751383Ab2GFJmH (ORCPT ); Fri, 6 Jul 2012 05:42:07 -0400 Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKT/ay7NcZS8A5zDFdRyezRzTowZdlMt3H@postini.com; Fri, 06 Jul 2012 09:42:06 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6B0B575; Fri, 6 Jul 2012 08:44:39 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 17ADF4D; Fri, 6 Jul 2012 05:38:23 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id EBB4A24C3E2; Fri, 6 Jul 2012 10:44:56 +0200 (CEST) Received: from lmenx30v.lme.st.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 6 Jul 2012 10:45:01 +0200 From: Loic Pallardy To: , Chris Ball Cc: Linus Walleij , STEricsson_nomadik_linux , Ulf Hansson , Loic Pallardy , Alex Macro Subject: [PATCH v1 4/5] mmc: core: Add mmc_set_blockcount feature Date: Fri, 6 Jul 2012 10:44:03 +0200 Message-ID: <1341564244-6178-5-git-send-email-loic.pallardy@stericsson.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1341564244-6178-1-git-send-email-loic.pallardy@stericsson.com> References: <1341564244-6178-1-git-send-email-loic.pallardy@stericsson.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Provide support for automatically sending Set Block Count (CMD23) messages. Used at least for RPMB support. Signed-off-by: Alex Macro Signed-off-by: Loic Pallardy Acked-by: Linus Walleij Acked-by: Johan Rudholm --- drivers/mmc/core/core.c | 14 ++++++++++++++ include/linux/mmc/core.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0b6141d..7990e2c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1827,6 +1827,20 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen) } EXPORT_SYMBOL(mmc_set_blocklen); +int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount, + bool is_rel_write) +{ + struct mmc_command cmd = {0}; + + cmd.opcode = MMC_SET_BLOCK_COUNT; + cmd.arg = blockcount & 0x0000FFFF; + if (is_rel_write) + cmd.arg |= 1 << 31; + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; + return mmc_wait_for_cmd(card->host, &cmd, 5); +} +EXPORT_SYMBOL(mmc_set_blockcount); + static void mmc_hw_reset_for_init(struct mmc_host *host) { if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 1b431c7..098b7dd 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -166,6 +166,8 @@ extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, extern unsigned int mmc_calc_max_discard(struct mmc_card *card); extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); +extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount, + bool is_rel_write); extern int mmc_hw_reset(struct mmc_host *host); extern int mmc_hw_reset_check(struct mmc_host *host); extern int mmc_can_reset(struct mmc_card *card);