From patchwork Thu Jul 26 07:12:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10545333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EAB2112B for ; Thu, 26 Jul 2018 07:14:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25DB72AD78 for ; Thu, 26 Jul 2018 07:14:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19DC22AD9A; Thu, 26 Jul 2018 07:14:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C11A2AD78 for ; Thu, 26 Jul 2018 07:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GeqyRhVwuogORtdJzo/d/mfH/iGi9TNNIQ3hOphGqJY=; b=YcX3C4J+R6tXRW RJ2MGOpNh0O4R+OBv73MTes+b099e1Wv/dvFlfOPPsz6+eAaVya5taB/wA5H6MoW7EBXAsnrNLNs2 I+3iOUcQlUu0Tbk5gpEo3jezEY/szYUuBEn3judF+ONYqjx2iON20JqINx+E3KWvVdrguMLtWQsHe /XjyfbWoq6EWxMx1AumfEopZjPbtLsWhA7MYgcyeMRVE/npVGFn9HKAdVsRHACda7jB5GBOt3xwyN ky6/+ad8zmZkuOOwvOrMYQMU8x8XdBaelVjhDin0GaiRRuFVQtGjXFj41YWtH9hOgcoO1vfOphqIZ DEQNiSjVVGrE7FLtD33A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiaU1-00008v-BS; Thu, 26 Jul 2018 07:14:45 +0000 Received: from mail-bn3nam01on0084.outbound.protection.outlook.com ([104.47.33.84] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiaTx-0008R3-Ty for linux-arm-kernel@lists.infradead.org; Thu, 26 Jul 2018 07:14:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oBNdgngxV6F5slvk6l8KUn4Gw+nIUof/U1bct/+gEzA=; b=fXmEopCX4mABPyVvk9vh4L+fVKlq3mWoef2IGthBeJ2kUKECQizKDyi5ykeH/pMJ3X3OsdnQR43+2uJGO25elChiwj4mGABOJ8k/TvippHoNVi3H8Q5TT7+Gz/SnqBsTGtwI5VTIB+y/wd9Mg2aATHwr5Wv6BBpF1qx0JY8VGUA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by SN1PR0301MB1583.namprd03.prod.outlook.com (2a01:111:e400:5232::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Thu, 26 Jul 2018 07:14:23 +0000 Date: Thu, 26 Jul 2018 15:12:07 +0800 From: Jisheng Zhang To: Adrian Hunter , Ulf Hansson Subject: [PATCH mmc-next v2 1/3] mmc: sdhci: add adma_table_num member to struct sdhci_host Message-ID: <20180726151207.6d8898f4@xhacker.debian> In-Reply-To: <20180726151017.4da1e336@xhacker.debian> References: <20180726151017.4da1e336@xhacker.debian> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TYAPR01CA0129.jpnprd01.prod.outlook.com (2603:1096:404:2d::21) To SN1PR0301MB1583.namprd03.prod.outlook.com (2a01:111:e400:5232::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8042e27c-022a-4c7c-3830-08d5f2c76b31 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060)(7193020); SRVR:SN1PR0301MB1583; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 3:EEt/8wOGbKDPia+zkKto4BD+4JP/sEz7o9io3eTe9rU0AYfu9CDoYh0iNr5VaRXCHwtU20VPLBAG8K/oSsTyzAPuWcxFo7eMtpAeLQMg3IO8EmQDPpca9dOTyrVWevjXXfaHY/G/6NXr9oPEKGg//kwxSa+fNxmMJPWAH5OVUuQyrdDSVQcFRIEj227TYFbRjVaPczr+wyv8UgER4tUhZQjqalfpSlUsyNhNc0l19wAKM90PfJIyB2f0G4tRlcmQ; 25:v5SEdIGJoKh8dhK8Yx655FusTCceTHc5k8CvBjATTft9GsKeDlzDgKAobc7kEPh3A1Iq02jGgmReuhdS1jsxZdmvUAK0J2eYnB1fnyUtEJK6N4x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2Hg9QOFfcymY/gBjxexFDLg2xrWY3HSbA0GPFmMj8vlZXsJA0v2E2jzFXGXkYRX3ypA6517nrp9NmzEmLjMsFb3Ipc/k4K3FkO0SVeQ+2tSx6wU0IRIKGPDE0wRO7FK/xzTILzivz0hG2uJwTPfN4wFJJqKYAERlQiJ0Rr338y/fgFfolxZAw7HFgrfU7svZeU447xPeOhBeuF3hXgtdjqXVJOi1ARv+YHLhyGgitYZDU/VMncz6px9/LecaUxGptpwuVJGFH/e0Ong== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN1PR0301MB1583; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0301MB1583; X-Forefront-PRVS: 07459438AA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(136003)(366004)(396003)(199004)(189003)(16526019)(26005)(5660300001)(186003)(68736007)(486006)(2906002)(97736004)(50466002)(7736002)(316002)(476003)(72206003)(86362001)(478600001)(11346002)(305945005)(6666003)(110136005)(956004)(106356001)(6506007)(3846002)(6116002)(9686003)(50226002)(23726003)(446003)(4326008)(1076002)(55016002)(33896004)(105586002)(76176011)(230700001)(53936002)(47776003)(8936002)(66066001)(7696005)(52116002)(81156014)(25786009)(81166006)(8676002)(386003)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1583; H:xhacker.debian; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us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KowWk5Qgw==; 5:N4m6Ba+ZLAYHgzV9+8YcAU/qJk0mKsYKodIAzLUiG48q8p2/Aau4IR2ziVuddjaKbBMzBpDd5nkAzpMOTT9vitEUQmwrGoBmQ9mpqi5oK+1oU7frTFn+DZKHVY1T8UZpDuoHyAYi9PRlW45J4vbzxwV0XBDyuV1a/uw+yzLFezs=; 7:VmBrdlJVs2AgPPlx3r672CDd/GdKjlRz7+O1qRcx+7fxM5wk5ghwWELj9ktWmWf2CkngsmfRIdDTu1WAoznvHGXVchLiqwZFGjyGglogMAGqFkJ/TmaTaiJS6NUu581tJdxv2U1nRKYQUw7qO9KQeRO8Rs+qoDa9jqiWj5ycLkefHKGzTO5iQV7m0CWQVg+VThAPJHyuoN7k56sfU2Aj97Ag/5MHDiAzmFs2uCjk2fCVcClU1IhVr8tTgDUJA35+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 07:14:23.9183 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8042e27c-022a-4c7c-3830-08d5f2c76b31 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1583 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180726_001442_032863_514886B1 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds adma_table_num member to struct sdhci_host to give more flexibility to drivers to control the ADMA table number. Default value of adma_table_num is set to (SDHCI_MAX_SEGS * 2 + 1). Signed-off-by: Jisheng Zhang --- drivers/mmc/host/sdhci.c | 17 +++++++++-------- drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a7b5602ef6f7..14dd4a49e03b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3316,6 +3316,13 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG; + /* + * The DMA descriptor table number is calculated as the maximum + * number of segments times 2, to allow for an alignment + * descriptor for each segment, plus 1 for a nop end descriptor. + */ + host->adma_table_num = SDHCI_MAX_SEGS * 2 + 1; + return host; } @@ -3561,18 +3568,12 @@ int sdhci_setup_host(struct sdhci_host *host) dma_addr_t dma; void *buf; - /* - * The DMA descriptor table size is calculated as the maximum - * number of segments times 2, to allow for an alignment - * descriptor for each segment, plus 1 for a nop end descriptor, - * all multipled by the descriptor size. - */ if (host->flags & SDHCI_USE_64_BIT_DMA) { - host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * + host->adma_table_sz = host->adma_table_num * SDHCI_ADMA2_64_DESC_SZ; host->desc_sz = SDHCI_ADMA2_64_DESC_SZ; } else { - host->adma_table_sz = (SDHCI_MAX_SEGS * 2 + 1) * + host->adma_table_sz = host->adma_table_num * SDHCI_ADMA2_32_DESC_SZ; host->desc_sz = SDHCI_ADMA2_32_DESC_SZ; } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 23966f887da6..d55fd7033e93 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -563,6 +563,8 @@ struct sdhci_host { /* Host SDMA buffer boundary. */ u32 sdma_boundary; + u32 adma_table_num; + u64 data_timeout; unsigned long private[0] ____cacheline_aligned;