From patchwork Fri Feb 7 18:39:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 3607211 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 534CE9F2D6 for ; Fri, 7 Feb 2014 18:40:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89F1920117 for ; Fri, 7 Feb 2014 18:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B249220114 for ; Fri, 7 Feb 2014 18:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751512AbaBGSkD (ORCPT ); Fri, 7 Feb 2014 13:40:03 -0500 Received: from mail-oa0-f73.google.com ([209.85.219.73]:52987 "EHLO mail-oa0-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209AbaBGSkC (ORCPT ); Fri, 7 Feb 2014 13:40:02 -0500 Received: by mail-oa0-f73.google.com with SMTP id i7so866317oag.2 for ; Fri, 07 Feb 2014 10:40:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=O9Kvp4NWfEbxhNki1ImDE1dumqg3tqwb7yWrnTXWg0U=; b=DRO4FZG/pzJDeeVr69a+8Fq8NOdW/w5mYF9d7WAYeQIS9KevhDFtn6FGiotuLeoeRa skFuRhnEHLevXIGhR12/US3YW3LQtZTdVvdQ1McN+RskVeVDHCd7TQ57FGNG9C/adPwq xS6Nl9PUb/O+LfSVi5FmeiXyTW9E8bbIk8taO+y7KIYB6qsobRCo90Ij8XEubrbe3qw9 OMg5ciZEF2031hflGn2jugtFhKyf/0eY+DeVyqtQGgxpwEUGUPlMPdbRMtdIzl/sRJMB 6OtTNy+d+HfIAwwLcVPmz72CPVUcSN31QwxB5lX/Vs98k9lOlOLkiPEgKmk69UWwRGGy uJIQ== X-Gm-Message-State: ALoCoQnoR/cLJdDCcvKnrjtFf0FUK0M57jUDtHp/fTHxHebw4Ye/xo9tgpZyPGZaSK+uS9SqQWbklKvE0VQBSexdtafnJqAWz0sqkPn3XQNkDLUea4f2uqQy3XqY6P0Lw8EayIxrB3E/u/afa6eDvf+jiFEixpJPENuGRcMAbaNTwGVcVowWPYOYR2lkRyIkOMb2a3Xrq1XbBpGZjqvTrK6NSTC61kSIVg== X-Received: by 10.182.236.74 with SMTP id us10mr6621828obc.36.1391798401445; Fri, 07 Feb 2014 10:40:01 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id i24si410776yhe.6.2014.02.07.10.40.01 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Feb 2014 10:40:01 -0800 (PST) Received: from puthik.mtv.corp.google.com (puthik.mtv.corp.google.com [172.22.72.136]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 3B0035A420E; Fri, 7 Feb 2014 10:40:01 -0800 (PST) Received: by puthik.mtv.corp.google.com (Postfix, from userid 218808) id C76F420095B; Fri, 7 Feb 2014 10:40:00 -0800 (PST) From: Puthikorn Voravootivat To: Chris Ball , Seungwon Jeon Cc: MMC list , Gwendal Grignou , Grant Grundler , Puthikorn Voravootivat Subject: [PATCH] dw-mmc: enable trim in eMMC device Date: Fri, 7 Feb 2014 10:39:58 -0800 Message-Id: <1391798398-24634-1-git-send-email-puthik@chromium.org> X-Mailer: git-send-email 1.9.0.rc1.175.g0b1dcb5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Force host to have erase capacity to enable trim or discard feature in supported eMMC device. Signed-off-by: Puthikorn Voravootivat --- In mmc_init_queue() before setting up the discard function, mmc driver will call mmc_can_erase() which will always return 0 because the host erase capacity is not set anywhere. So to enable discard function, we need to add erase capacity to the host. drivers/mmc/host/dw_mmc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 55cd110..f47f1c1 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -55,6 +55,8 @@ #define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */ #define DW_MCI_FREQ_MIN 400000 /* unit: HZ */ +#define DW_MCI_DEFAULT_CAPS (MMC_CAP_ERASE) + #ifdef CONFIG_MMC_DW_IDMAC #define IDMAC_INT_CLR (SDMMC_IDMAC_INT_AI | SDMMC_IDMAC_INT_NI | \ SDMMC_IDMAC_INT_CES | SDMMC_IDMAC_INT_DU | \ @@ -2371,6 +2373,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) return ERR_PTR(-ENOMEM); } + pdata->caps |= DW_MCI_DEFAULT_CAPS; + /* find out number of slots supported */ if (of_property_read_u32(dev->of_node, "num-slots", &pdata->num_slots)) {